<?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: if statement with three &amp;quot;and&amp;quot; criteria in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654099#M196501</link>
    <description>&lt;P&gt;Thank you everyone! I am new to posting questions so I accepted one solution... yet, you all really helped!&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jun 2020 03:40:27 GMT</pubDate>
    <dc:creator>jaimedba</dc:creator>
    <dc:date>2020-06-08T03:40:27Z</dc:date>
    <item>
      <title>if statement with three "and" criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654072#M196482</link>
      <description>&lt;P&gt;I want to use multiple "and" criteria with an if statement. The &lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;and&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; (bold, italic, and underlined in the code below) is not blue in my SAS program...can I use more than two and's within an if function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data temp.compQTR_WinRaw2a; set temp.compQTR_WinRaw2;&lt;BR /&gt;if (datacqtr = .) and (fyr = "12") then datacqtr = datafqtr;&lt;BR /&gt;if (datacqtr = .) and (fyr = "3") &lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;and&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; (fqtr = "4") then datacqtr = cats(fyearq, "Q1");&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I greatly appreciate any help.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jun 2020 23:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654072#M196482</guid>
      <dc:creator>jaimedba</dc:creator>
      <dc:date>2020-06-07T23:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: if statement with three "and" criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654073#M196483</link>
      <description>&lt;P&gt;As a general rule you don't need to rely on the editor colour-coding to tell you if your sytax is correct or not - the colour-coding isn't always "correct". Simply just run the code and the SAS log will tell you if you have a syntax error or not. Multiple AND conditions are perfectly OK.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jun 2020 23:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654073#M196483</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-06-07T23:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: if statement with three "and" criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654074#M196484</link>
      <description>&lt;P&gt;There should not be any trouble because of multiple AND's in a single comparison as you show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The fun part comes when mixing AND with OR. Not that it is syntactically incorrect but that many people have not studied the interaction in logical terms and get unexpected results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Syntax highlighting is&amp;nbsp;&lt;STRONG&gt;not&lt;/STRONG&gt; the true test of the validity of the code. It's what the LOG and data results show.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 14:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654074#M196484</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-08T14:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: if statement with three "and" criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654076#M196486</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/332713"&gt;@jaimedba&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Multiple AND are totally o.k.&lt;/P&gt;
&lt;P&gt;Also use ELSE if there is a set of multiple related IF conditions.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp.compQTR_WinRaw2a; 
  set temp.compQTR_WinRaw2;
  if missing(datacqtr) and fyr = "12" then datacqtr = datafqtr;
  else if missing(datacqtr) and fyr in ('3','4') then datacqtr = cats(fyearq, "Q1");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And looking at your code guessing what you're doing: You will at one point in the rather near future also have to learn how you can work with SAS date values and formats. Once you master this working with dates in SAS will become easier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Syntax highlighting for the code you've posted looks o.k. in my EG 8.2 version.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1591578405628.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/40639i10C8C7C160E48875/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1591578405628.png" alt="Patrick_0-1591578405628.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 01:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654076#M196486</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-06-08T01:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: if statement with three "and" criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654077#M196487</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&amp;gt;&amp;nbsp;&lt;EM&gt;Syntax highlighting is the true test of the validity of the code.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;You might have forgotten a word &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 00:58:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654077#M196487</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-06-08T00:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: if statement with three "and" criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654099#M196501</link>
      <description>&lt;P&gt;Thank you everyone! I am new to posting questions so I accepted one solution... yet, you all really helped!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 03:40:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654099#M196501</guid>
      <dc:creator>jaimedba</dc:creator>
      <dc:date>2020-06-08T03:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: if statement with three "and" criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654536#M196550</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&amp;gt;&amp;nbsp;&lt;EM&gt;Syntax highlighting is the true test of the validity of the code.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;You might have forgotten a word &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Fixed. Thank you. I have noticed a marked increase in typos since working at a "new" "temporary" desk and I don't always catch them on the quick proof read.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 14:11:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-with-three-quot-and-quot-criteria/m-p/654536#M196550</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-08T14:11:06Z</dc:date>
    </item>
  </channel>
</rss>

