title: SAS - Plot multiple time series in one picture (long format data)
body: <p>I have data like this:</p>
  
  <pre><code>data mydata;
      input date class y;
      datalines;
      19900 1 10
      19900 2 11
      19900 3 14
      20000 1 12
      20000 2 15
      20000 3 17
  ;
  run;
  </code></pre>
  
  <p>Now I want to plot date - y time series. I want to get one line for each class.</p>
  
  <p>This code achieves already just what I am trying to do:</p>
  
  <pre><code>proc transpose data=mydata out=transposed;
      id class;
      by date;
  run;
  
  proc sgplot data=transposed;
      series x=date y=_1;
      series x=date y=_2;
      series x=date y=_3;
      yaxis label="y";
  run;
  </code></pre>
  
  <p>But this doesn't work for me because the number of class variables might be changing. I suppose I could use some kind of macro loop there but then the code starts to get pretty complicated. </p>
  
  <p>I would like to know if there is some feature or statement which produces the plot easily. Preferably even without proc transpose statement.</p>
  
  <p>I am using SAS 9.3 but soon moving to 9.4 so 9.4 specific answers are welcome as well.</p>
  
  <p>Thanks.</p>