title: apply keep and where together sas
body: <p>I am working with sas to manipulate some dataset.
  I am using the data step to apply some condition to keep columns and filter on some values.
  The problem is that I would like to filter on columns that in the end I will not need, so I would like to apply, first, the where clause, and then the keep clause.
  The problem is that sas executes, first the keep clause and then where, so when it is trying to apply the where instruction it doesn't find the columns on which it should be applied on. This is my code:</p>
  
  <pre><code>data newtable;
  set mytable(where=(var1&lt;value)
  keep var2);
  end;
  </code></pre>
  
  <p>In this case the error is the var1 cannot be found since I decided to keep only var2. I know I can do two data steps, but I would like to do everything in one step only.
  How can I achieve this?</p>