<?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: AND and OR statements in sas problem in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170060#M43924</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That doesn't seem like valid SAS code, I think you missed an else for one and a typo, value vs values.&lt;/P&gt;&lt;P&gt;Is this closer:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;IF A&amp;nbsp; le&amp;nbsp; X&amp;nbsp; and B =''&amp;nbsp; then value= 1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;ELSE if A le X and B lt A&amp;nbsp; then value=1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;else value=0;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Oct 2014 18:34:34 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-10-02T18:34:34Z</dc:date>
    <item>
      <title>AND and OR statements in sas problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170058#M43922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can this&amp;nbsp; EXCEL statement be written in SAS &lt;/P&gt;&lt;P&gt;Excel version:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=IF(OR(AND(A&amp;lt;=X,ISBLANK(B)),(AND(A&amp;lt;=X,B&amp;lt;A))),1,0)&lt;/P&gt;&lt;P&gt;in Other words, if A&amp;lt;=X and B is blank then&amp;nbsp; then variable value =1 OR if A&amp;lt;=X and B&amp;lt;1 then variable value =1 else variable value=c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've used a SAS statement like this:&lt;/P&gt;&lt;P&gt;data want&lt;/P&gt;&lt;P&gt;let value $10:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;iF A is&amp;nbsp; le&amp;nbsp; X&amp;nbsp; and B =''&amp;nbsp; then value= ‘1’:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;if A&amp;nbsp; is le X and B lt A&amp;nbsp; then values='1':&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;else value=0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;these statements do not bring up correct results. How do use the OR statement correctly here? I think the error is in the implementation of OR.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 18:12:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170058#M43922</guid>
      <dc:creator>zetter</dc:creator>
      <dc:date>2014-10-02T18:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: AND and OR statements in sas problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170059#M43923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With SAS, TRUE is 1 and FALSE is 0, so your expression can be written:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;value = A&amp;lt;=X and (missing(B) or B&amp;lt;A);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 18:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170059#M43923</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-10-02T18:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: AND and OR statements in sas problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170060#M43924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That doesn't seem like valid SAS code, I think you missed an else for one and a typo, value vs values.&lt;/P&gt;&lt;P&gt;Is this closer:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;IF A&amp;nbsp; le&amp;nbsp; X&amp;nbsp; and B =''&amp;nbsp; then value= 1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;ELSE if A le X and B lt A&amp;nbsp; then value=1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;else value=0;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 18:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170060#M43924</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-10-02T18:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: AND and OR statements in sas problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170061#M43925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you want to do if A is missing? Missing values are always less than anything else and you want to make sure you are getting expected results. If you don't want to assign 1 when A is missing you need to address that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 19:39:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170061#M43925</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-02T19:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: AND and OR statements in sas problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170062#M43926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What about this:&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;IF A ne. and A&amp;nbsp; le&amp;nbsp; X&amp;nbsp; and B =.&amp;nbsp; then value= 1;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;ELSE if A ne. and A le X and B lt A&amp;nbsp; then value=1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;else value=0;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 19:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/AND-and-OR-statements-in-sas-problem/m-p/170062#M43926</guid>
      <dc:creator>zetter</dc:creator>
      <dc:date>2014-10-02T19:55:40Z</dc:date>
    </item>
  </channel>
</rss>

