<?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: Conflicting indicator variable code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-indicator-variable-code/m-p/136153#M261120</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both very much for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Jan 2014 15:34:41 GMT</pubDate>
    <dc:creator>Bruce123</dc:creator>
    <dc:date>2014-01-09T15:34:41Z</dc:date>
    <item>
      <title>Conflicting indicator variable code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-indicator-variable-code/m-p/136150#M261117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have a small code for creating a indicator variable. But the code is conflicting with each other and so one of the statements is not been read by SAS, and I do not know of another way to write it. &lt;/P&gt;&lt;P&gt;My code can be seen below: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data want;&lt;/P&gt;&lt;P&gt;Length Colour $6;&lt;/P&gt;&lt;P&gt;Set Have;&lt;/P&gt;&lt;P&gt;If Performance_2014 &amp;lt;0 And Performance_2013 &amp;lt;0 And Performance_2012 &amp;lt;0 And Performance_2011 &amp;lt;0 then indikator = 1;&lt;/P&gt;&lt;P&gt;Else indikator = 3;&lt;/P&gt;&lt;P&gt;If Performance_2014 &amp;lt;0 And Performance_2013 &amp;lt;0 And Performance_2012 &amp;lt;0 then indikator = 2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If all 4 years are negative, the indicator still gives the value "2" because of the second statement, even though it should give "1", .&lt;/P&gt;&lt;P&gt;Is there anyway to ask SAS to first check if all 4 years have a negative value and if this is not true, then check if the last 3 years are negative?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I managed to get this to work in excel, but not in SAS. In excel it would look like this:&lt;/P&gt;&lt;P&gt;If(and(C2&amp;lt;0;D2&amp;lt;0;E2&amp;lt;0;F2&amp;lt;0);"0";If(and(D2&amp;lt;0;E2&amp;lt;0;F2&amp;lt;0);"1";"3"))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your time and help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 15:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conflicting-indicator-variable-code/m-p/136150#M261117</guid>
      <dc:creator>Bruce123</dc:creator>
      <dc:date>2014-01-09T15:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting indicator variable code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-indicator-variable-code/m-p/136151#M261118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just make sure to use proper IF/THEN/ELSE nesting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If Performance_2014 &amp;lt;0 And Performance_2013 &amp;lt;0 And Performance_2012 &amp;lt;0 And Performance_2011 &amp;lt;0 then indikator = 1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG&gt;ELSE &lt;/STRONG&gt;If Performance_2014 &amp;lt;0 And Performance_2013 &amp;lt;0 And Performance_2012 &amp;lt;0 then indikator = 2;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Else indikator = 3;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 15:20:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conflicting-indicator-variable-code/m-p/136151#M261118</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-01-09T15:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting indicator variable code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-indicator-variable-code/m-p/136152#M261119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;If Performance_2014 &amp;lt;0 And Performance_2013 &amp;lt;0 And Performance_2012 &amp;lt;0 And Performance_2011 &amp;lt;0 then indikator = 1;&lt;/P&gt;&lt;P&gt;Else If Performance_2014 &amp;lt;0 And Performance_2013 &amp;lt;0 And Performance_2012 &amp;lt;0 then indikator = 2;&lt;/P&gt;&lt;P&gt;Else indikator = 3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; You could also try the IFN Function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 15:26:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conflicting-indicator-variable-code/m-p/136152#M261119</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2014-01-09T15:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting indicator variable code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-indicator-variable-code/m-p/136153#M261120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both very much for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 15:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conflicting-indicator-variable-code/m-p/136153#M261120</guid>
      <dc:creator>Bruce123</dc:creator>
      <dc:date>2014-01-09T15:34:41Z</dc:date>
    </item>
  </channel>
</rss>

