<?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: what is the difference betwwe multiple &amp;quot;if&amp;quot; and one if with multiple condition? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference-betwwe-multiple-quot-if-quot-and-one-if/m-p/747700#M234735</link>
    <description>&lt;P&gt;The same is true for this condition.&lt;/P&gt;
&lt;P&gt;However, repeating if may cause unintended conditional branches in data and conditions. For exclusive cases, it is better to use if-else or select-when.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jun 2021 06:42:36 GMT</pubDate>
    <dc:creator>japelin</dc:creator>
    <dc:date>2021-06-14T06:42:36Z</dc:date>
    <item>
      <title>what is the difference betwwe multiple "if" and one if with multiple condition?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference-betwwe-multiple-quot-if-quot-and-one-if/m-p/747686#M234728</link>
      <description>&lt;P&gt;Hi all, I have the code below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want;
 SET have;
 If cvt_yr=-4 then dkt_4=1;
 else if cvt_yr=-3 then dkt_3=1;
 else if cvt_yr=-2 then dkt_2=1;
 else if cvt_yr=-1 then dkt_1=1;
 else if cvt_yr=0 then dkt=1;
 else if cvt_yr=1 then dkt1=1;
 else if cvt_yr=2 then dkt2=1;
 else if cvt_yr=3 then dkt3=1;
 else if cvt_yr&amp;gt;=4 then dkt4=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am wondering what is the difference between this code with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want;
 SET have;
 If cvt_yr=-4 then dkt_4=1;
 if cvt_yr=-3 then dkt_3=1;
 if cvt_yr=-2 then dkt_2=1;
if cvt_yr=-1 then dkt_1=1;
  if cvt_yr=0 then dkt=1;
  if cvt_yr=1 then dkt1=1;
 if cvt_yr=2 then dkt2=1;
  if cvt_yr=3 then dkt3=1;
 if cvt_yr&amp;gt;=4 then dkt4=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV id="gtx-trans" style="position: absolute; left: 48px; top: 414.5px;"&gt;
&lt;DIV class="gtx-trans-icon"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 14 Jun 2021 06:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference-betwwe-multiple-quot-if-quot-and-one-if/m-p/747686#M234728</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-06-14T06:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference betwwe multiple "if" and one if with multiple condition?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference-betwwe-multiple-quot-if-quot-and-one-if/m-p/747693#M234732</link>
      <description>&lt;P&gt;The result will be the same in this precise case, but the first code is more efficient as not all tests are executed.&lt;/P&gt;
&lt;P&gt;Also please align/format your code properly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; This is much helped by never using tabs and using spaces instead. This way any cut-and-paste is sure to retain the original format.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 06:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference-betwwe-multiple-quot-if-quot-and-one-if/m-p/747693#M234732</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-06-14T06:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference betwwe multiple "if" and one if with multiple condition?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference-betwwe-multiple-quot-if-quot-and-one-if/m-p/747698#M234734</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next time I will Ctrl+I before paste.&lt;/P&gt;
&lt;P&gt;Have a good week!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 06:38:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference-betwwe-multiple-quot-if-quot-and-one-if/m-p/747698#M234734</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-06-14T06:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference betwwe multiple "if" and one if with multiple condition?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference-betwwe-multiple-quot-if-quot-and-one-if/m-p/747700#M234735</link>
      <description>&lt;P&gt;The same is true for this condition.&lt;/P&gt;
&lt;P&gt;However, repeating if may cause unintended conditional branches in data and conditions. For exclusive cases, it is better to use if-else or select-when.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 06:42:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference-betwwe-multiple-quot-if-quot-and-one-if/m-p/747700#M234735</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-06-14T06:42:36Z</dc:date>
    </item>
  </channel>
</rss>

