title: SAS - Sort Multiple Dataset using loops
body: <p>I have a list of SAS datasets which I want to sort by the same variable.</p>
  
  <p>I do not want to use the PROC Sort statement for each one of them,
  is there a way to use loops to shorten the entire code?</p>
  
  <p>I am new to SAS so please help!</p>
  
  <pre><code>%let prim =sasdata.qc_no_rx ;
  %let other_removals = sasdata.qc_other_removals;
  %let drops =sasdata.droplist;
  
  
  Array data_1(3) $ sasdata.qc_no_rx sasdata.qc_other_removals 
  
  sasdata.droplist ; 
  
  do over data_1;
  Proc sort data = data_1 ;
  by ims_ref;
  end;
  </code></pre>