title: sas sorting and filtering by id
body: <p>I have columns named <code>id</code> and <code>key</code>. I sorted the data by <code>id</code> and I need to get the first 5 keys of every <code>id</code>.</p>
  
  <pre><code>PROC SQL OUTOBS=5;
     CREATE TABLE WORK.QUERY_001 AS 
     SELECT DISTINCT t1.*      
        FROM work.DATA t1
        ORDER BY t1.id,
                 t1.key DESC;
  QUIT;
  </code></pre>