<?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 then else clause problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-clause-problem/m-p/720307#M223126</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like that we do not need the condition s26=. at the code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if s26 &amp;gt; 0 and s26 ne . then fcf=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;because &lt;STRONG&gt;.&lt;/STRONG&gt; is the smallest obs in the dataset, isn't it ?&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2021 19:40:05 GMT</pubDate>
    <dc:creator>Phil_NZ</dc:creator>
    <dc:date>2021-02-18T19:40:05Z</dc:date>
    <item>
      <title>if then else clause problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-clause-problem/m-p/720161#M223060</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS, I have a question about if then else clause.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a variable name &lt;STRONG&gt;s26&lt;/STRONG&gt;. I want to set up &lt;STRONG&gt;if s26 is higher than 0 and s26 ne. then fcf=1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If s26 is lower than 0 and s26 ne. then fcf=0&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please suggest to me how to code it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 12:06:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-clause-problem/m-p/720161#M223060</guid>
      <dc:creator>ResoluteCarbon</dc:creator>
      <dc:date>2021-02-18T12:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: if then else clause problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-clause-problem/m-p/720163#M223061</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/366546"&gt;@ResoluteCarbon&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am new to SAS, I have a question about if then else clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a variable name &lt;STRONG&gt;s26&lt;/STRONG&gt;. I want to set up &lt;STRONG&gt;if s26 is higher than 0 and s26 ne. then fcf=1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If s26 is lower than 0 and s26 ne. then fcf=0&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please suggest to me how to code it?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The code is essentially what you wrote, except you use &amp;gt; or &amp;lt; symbols&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if s26 &amp;gt; 0 and s26 ne . then fcf=1;
else if s26 &amp;lt; 0 and s26 ne . then fcf=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A simplification because if s26 &amp;gt; 0 then it has to be not equal to missing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if s26 &amp;gt; 0 then fcf=1;
else if s26 &amp;lt; 0 and s26 ne . then fcf=0;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Feb 2021 12:30:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-clause-problem/m-p/720163#M223061</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T12:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: if then else clause problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-clause-problem/m-p/720167#M223063</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/366546"&gt;@ResoluteCarbon&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Further to what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;has said, I recommend you also consider what the logic should do if s26 = 0, for example, flag an error condition or include this possibility in one of the branches of the if statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 12:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-clause-problem/m-p/720167#M223063</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2021-02-18T12:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: if then else clause problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-clause-problem/m-p/720307#M223126</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like that we do not need the condition s26=. at the code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if s26 &amp;gt; 0 and s26 ne . then fcf=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;because &lt;STRONG&gt;.&lt;/STRONG&gt; is the smallest obs in the dataset, isn't it ?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 19:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-clause-problem/m-p/720307#M223126</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-18T19:40:05Z</dc:date>
    </item>
  </channel>
</rss>

