title: How to join multiple columns into one in sas
body: <p>I have a time series SAS dataset and I want to transfer it to vertical dataset.</p>
  
  <p>My data looks like..</p>
  
  <pre><code>ID A2009 A2010 A2011 A2012
  1      1     2     3     4  
  2      1     2     3     4   
  3      1     2     3     4   
  4      1     2     3     4   
  5      1     2     3     4    
  
  data multcol;
  infile datalines;
  input ID A2009 A2010 A2011 A2012 A2013;
  return;
  datalines;
  1 1 2 3 4 5
  2 1 2 3 4 5
  3 1 2 3 4 5
  4 1 2 3 4 5
  5 1 2 3 4 5
  ;
  run;
  
  proc print data=multcol noobs;
  run;
  </code></pre>
  
  <p>I search the web only find someone's solution as following.Not worked.
  But my dataset is too large, this method shut down my computer.</p>
  
  <pre><code>data cmbcol(keep=a orig_varname orig_obsnum);
  set multcol;
  array myvars _numeric_;
  do i = 2 to dim(myvars);
  orig_varname = vname(myvars(i));
  orig_obsnum = _n_;
  A = myvars(i);
  output;
  end;
  run;
  
  proc print data=cmbcol ;
  title 'cmbcol';
  run;
  
  proc sort data=cmbcol;
  by orig_varname a;
  run;
  
  proc print data=cmbcol noobs;
  title 'cmbcol';
  run;
  </code></pre>
  
  <p>And I want them to become like this.</p>
  
  <pre><code>ID  t  t+1  
  1   1   2    
  2   1   2    
  3   1   2 
  4   1   2   
  5   1   2  
  1   2   3
  2   2   3
  3   2   3
  4   2   3
  5   2   3
  1   3   4
  2   3   4
  3   3   4
  4   3   4
  5   3   4
  </code></pre>
  
  <p>How can we do that?</p>
  
  <p>Thanks in advance.</p>