title: SAS - transpose multiple variables in rows to columns
body: <p>I'm trying to use an array to accomplish the following. However, I've never used one before and I'm having a bit of trouble.</p>
  
  <p>Basically I want to take the following data and create one row(observation) for each acct, seq1, seq2 combination:</p>
  
  <pre><code>acct  seq1 seq2  la      ln
  9999    1   10   20.01   100
  9999    1   10   19.05   1
  9999    2   11   26.77   100
  9999    2   11   24.86   1
  8888    3   20   38.43   218
  8888    3   20   37.53   1
  </code></pre>
  
  <p>This is what I want to end up with. Note, I'm only showing la1 through la3 and ln1 through ln3 for the sake of space. It would actually to go to la7 and ln7:</p>
  
  <pre><code>acct  seq1  seq2     la1     la2    la3  ln1    ln2 ln3
  9999    1   10      20.01   19.05   .    100     1   .
  9999    2   11      26.77   24.86   .    100     1   .
  8888    3   20      38.43   37.53   .    218     1   .
  </code></pre>
  
  <p>Here is the code that I've attempted so far. Any assistance would be greatly appreciated:</p>
  
  <pre><code>data want;
  set have; 
  by acct seq1 seq2;
  if first.seq2 then do;
  array la_array {7} la1-la7;
  array ln_array {7} ln1-ln7;
  end;
  do i = 1 to 7;
  la_array(i)=la;
  ln_array(i)=ln;
  end;
  run;
  </code></pre>