<?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 condition in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/IF-condition/m-p/288922#M59592</link>
    <description>&lt;P&gt;The statement must either be a &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; (which means a where condition that is applied directly on the input data before the data step iteration begins) or an &lt;FONT face="courier new,courier"&gt;if&lt;/FONT&gt; (subsetting if, is processed at the place it is written in the data step).&lt;/P&gt;
&lt;P&gt;Within both, you need to define a condition that yields a boolean value (in SAS, this means a numeric value; 0 is false, any non-zero value - usually 1 - is true).&lt;/P&gt;
&lt;P&gt;So, if is not allowed within the where condition. You need to build your condition using &lt;FONT face="courier new,courier"&gt;and&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;or&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;not&lt;/FONT&gt; as logical (boolean) operators.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where
  nf = 0 and fownff &amp;gt; 0.2 and fownfnf &amp;gt; 0.2
  or
  nf = 1 and dg &amp;gt; 0.2
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that logical &lt;FONT face="courier new,courier"&gt;and&lt;/FONT&gt; takes precedence over logical &lt;FONT face="courier new,courier"&gt;or&lt;/FONT&gt; in the evaluation, so no parentheses are needed.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Aug 2016 13:07:19 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-08-02T13:07:19Z</dc:date>
    <item>
      <title>IF condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/IF-condition/m-p/288916#M59591</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data of 4300 lines which now I want to take only part of data for regression.&lt;/P&gt;&lt;P&gt;I have a continouse variables which called FOWNFF, FOWNFNF, DG while nf is 0,1 variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want that my population will be: FOWNFF&amp;gt;0.2 and FOWNFNF&amp;gt;0.2 and if nf=1 than take the variable while it is DG&amp;gt;0.2&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; fownff&amp;gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0.2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; and fownfnf&amp;gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0.2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; if nf=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; and dg&amp;gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0.2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;that is what I wrote and got an error. The log is:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;ERROR: Syntax error while parsing WHERE clause.&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, AND, EQ, GE, GT,&lt;/P&gt;&lt;P&gt;LE, LT, NE, NOT, OR, ^, ^=, |, ||, ~, ~=.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be acceptable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 12:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/IF-condition/m-p/288916#M59591</guid>
      <dc:creator>yael</dc:creator>
      <dc:date>2016-08-02T12:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: IF condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/IF-condition/m-p/288922#M59592</link>
      <description>&lt;P&gt;The statement must either be a &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; (which means a where condition that is applied directly on the input data before the data step iteration begins) or an &lt;FONT face="courier new,courier"&gt;if&lt;/FONT&gt; (subsetting if, is processed at the place it is written in the data step).&lt;/P&gt;
&lt;P&gt;Within both, you need to define a condition that yields a boolean value (in SAS, this means a numeric value; 0 is false, any non-zero value - usually 1 - is true).&lt;/P&gt;
&lt;P&gt;So, if is not allowed within the where condition. You need to build your condition using &lt;FONT face="courier new,courier"&gt;and&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;or&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;not&lt;/FONT&gt; as logical (boolean) operators.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where
  nf = 0 and fownff &amp;gt; 0.2 and fownfnf &amp;gt; 0.2
  or
  nf = 1 and dg &amp;gt; 0.2
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that logical &lt;FONT face="courier new,courier"&gt;and&lt;/FONT&gt; takes precedence over logical &lt;FONT face="courier new,courier"&gt;or&lt;/FONT&gt; in the evaluation, so no parentheses are needed.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 13:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/IF-condition/m-p/288922#M59592</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-08-02T13:07:19Z</dc:date>
    </item>
  </channel>
</rss>

