title: SAS If conditional before PROC SORT
body: <pre><code>if &amp;var. not in ('quarter' 'period' 'year') then do;
      proc sort data=test_&amp;var.;
          by descending column1;
      run;
  end;
  </code></pre>
  
  <p>I'm trying to attach a conditional statement before a proc sort statement, but I'm having trouble getting the IF to work outside of a data step. Is there some way around this?</p>
  
  <p>Basically I don't want to sort any test_&amp;var. datasets that contain a time variable as those are the only datasets I want to retain a particular sequence in.</p>