title: SAS how groupformat works
body: <p>I found this on SAS official website.</p>
  
  <p><code>Use the GROUPFORMAT option in the BY statement to ensure that
   1. formatted values are used to group observations when a FORMAT statement and a BY statement are used together in a DATA step
   2. the FIRST.variable and LAST.variable are assigned by the formatted values of the variable</code></p>
  
  <p>And the example it uses to illustrate the usage of <code>groupformat</code> is </p>
  
  <pre><code>proc format;
     value range
        low -55 = 'Under 55'
        55-60   = '55 to 60'
        60-65   = '60 to 65'
        65-70   = '65 to 70'
        other   = 'Over 70';
  run;
  
  proc sort data=class out=sorted_class;
     by height;
  run;
  
  data _null_;
     format height range.;
     set sorted_class;
        by height groupformat;
     if first.height then
        put 'Shortest in ' height 'measures ' height:best12.;
  run;
  </code></pre>
  
  <p>But I don't understand how this example shows <code>groupformat</code> "ensures" 
  <code>formatted values are used to group observations when a FORMAT statement and a BY statement are used together in a DATA step</code>.</p>