title: SAS - PROC SQL - Case When arithmetic not making sense
body: <p>In SAS Proc SQL, I am using this Case statement to try to mark policies that have differences other than .015 per year:</p>
  
  <pre><code>CASE WHEN (MOD1 - MOD0) NOT = .015 THEN 2
       WHEN (MOD2 - MOD1) NOT = .015 THEN 3
       WHEN (MOD3 - MOD2) NOT = .015 THEN 4
       WHEN (MOD4 - MOD3) NOT = .015 THEN 5
       ELSE 0 END
  </code></pre>
  
  <p>The weird thing is it doesn't work when it feels like it should. ( e.g. mod1 = .955 and mod0 = .94 but the first statement believes its not .015) At first I believed it to be an issue with digits but that never worked. </p>
  
  <p>Oddly enough this does work and I don't know why. </p>
  
  <pre><code>CASE WHEN (MOD1 - MOD0) NOT = (1- .985) THEN 2
       WHEN (MOD2 - MOD1) NOT = (1- .985) THEN 3
       WHEN (MOD3 - MOD2) NOT = (1- .985) THEN 4
       WHEN (MOD4 - MOD3) NOT = (1- .985) THEN 5
       ELSE 0 END
  </code></pre>
  
  <p>But this doesn't work </p>
  
  <pre><code>CASE WHEN (MOD1 - MOD0) NOT = (.2- .185) THEN 2
       WHEN (MOD2 - MOD1) NOT = (.2- .185) THEN 3
       WHEN (MOD3 - MOD2) NOT = (.2- .185) THEN 4
       WHEN (MOD4 - MOD3) NOT = (.2- .185) THEN 5
       ELSE 0 END
  </code></pre>
  
  <p>I have workarounds to get around any of these (including using data steps) so I'm not really looking for solutions to the issue but more answers as to what is going on here. I like to understand why things don't work rather than just knowing what I can and can't do. </p>
  
  <p>Thanks!</p>