title: SAS `select`...`when` based on range
body: <p>I have blocks of code which need to be done if a fixed variable falls into a particular range, e.g.</p>
  
  <pre><code>IF attained_age &gt; 84 AND attained_age &lt; 90 then
      do;
         /* block 1*/
      end;
  ELSE IF attained_age &gt; 89 AND attained_age &lt; 95 then
      do;
         /* block 2*/
      end;
  ELSE IF attained_age &gt; 94 then
      do;
         /* block 3*/
      end;
  </code></pre>
  
  <p>Is there a better way of writing this, with something like <code>SELECT...WHEN</code> for example? I would prefer not to list all individual values of attained age in the <code>WHEN</code> clauses though...</p>
  
  <p><strong>UPDATE</strong> Blocks of code involve setting a group of variables with similar names, e.g.</p>
  
  <pre><code>sev_alpha = &amp;UFLIC_LM_90_94_Alpha;
  sev_sigma = &amp;UFLIC_LM_90_94_Sigma;        
  sev_theta = &amp;UFLIC_LM_90_94_Theta;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>sev_alpha = &amp;UFLIC_LM_95_Alpha;
  sev_sigma = &amp;UFLIC_LM_95_Sigma;
  sev_theta = &amp;UFLIC_LM_95_Theta;
  </code></pre>