<?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: why does this code not work? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/why-does-this-code-not-work/m-p/740758#M29086</link>
    <description>&lt;P&gt;In Boolean (yes/no) logic, the AND operator takes precedence over OR (like multiplication takes precedence over addition in calculus). This means that your condition will be evaluated like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where
  (not missing(dato_diagnose) and not missing(totsssy))
  or not missing(totlmdb)
  or not missing(totdrga)
  or not missing(totdrgh)
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To make your condition work as intended, you need to force precedence by using brackets:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where
  not missing(dato_diagnose) and (
    not missing(totsssy)
    or not missing(totlmdb)
    or not missing(totdrga)
    or not missing(totdrgh)
  )
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that it is always a great help to make functional code blocks visible by using indentation.&lt;/P&gt;</description>
    <pubDate>Wed, 12 May 2021 11:04:47 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-05-12T11:04:47Z</dc:date>
    <item>
      <title>why does this code not work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/why-does-this-code-not-work/m-p/740752#M29083</link>
      <description>&lt;P&gt;Hi. I have a big dataset on a secure server.&lt;/P&gt;&lt;P&gt;I am cleaning my data, but now I found out that one code does not work and I can not figure out why, maybe you have an suggestion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is:&lt;/P&gt;&lt;P&gt;data total;&lt;/P&gt;&lt;P&gt;set mergetot;&lt;/P&gt;&lt;P&gt;where not missing(dato_diagnose) and not missing(totsssy) or not missing(totlmdb) or not missing(totdrga) or not missing(totdrgh);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to only have the observations where there is a value for dato_diagnose and where at least one of totsssy, totlmdb, totdrga and totdrgh has a value.&lt;/P&gt;&lt;P&gt;somehow I still get observations where there is no value for dato_diagnose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you find the mistake?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kind regards&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 10:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/why-does-this-code-not-work/m-p/740752#M29083</guid>
      <dc:creator>Jannie_D</dc:creator>
      <dc:date>2021-05-12T10:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: why does this code not work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/why-does-this-code-not-work/m-p/740755#M29084</link>
      <description>&lt;P&gt;Perhaps this, which will test to see if there is at least one non-missing among the rest of the variables&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where not missing(dato_diagnose) AND (not missing(totsssy) + not missing(totlmdb) + not missing(totdrga) + not missing(totdrgh))&amp;gt;0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 12 May 2021 10:39:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/why-does-this-code-not-work/m-p/740755#M29084</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-12T10:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: why does this code not work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/why-does-this-code-not-work/m-p/740758#M29086</link>
      <description>&lt;P&gt;In Boolean (yes/no) logic, the AND operator takes precedence over OR (like multiplication takes precedence over addition in calculus). This means that your condition will be evaluated like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where
  (not missing(dato_diagnose) and not missing(totsssy))
  or not missing(totlmdb)
  or not missing(totdrga)
  or not missing(totdrgh)
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To make your condition work as intended, you need to force precedence by using brackets:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where
  not missing(dato_diagnose) and (
    not missing(totsssy)
    or not missing(totlmdb)
    or not missing(totdrga)
    or not missing(totdrgh)
  )
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that it is always a great help to make functional code blocks visible by using indentation.&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 11:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/why-does-this-code-not-work/m-p/740758#M29086</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-12T11:04:47Z</dc:date>
    </item>
  </channel>
</rss>

