title: Copying/renaming multiple sas datasets based on macrovariables values
body: <p>I have a macro variable <code>&amp;myfiles</code> which contains a list of the names of four datasets. </p>
  
  <pre><code>%put &amp;myfiles;
  cpo.CDR_2016jun cpo.Cog_2016jun cpo.Mile_2016jun cpo.Path_2016jun
  </code></pre>
  
  <p>Where <code>cpo</code> is a libname.</p>
  
  <p>I'm trying to create four new datasets with names from another macro variable which I've named <code>&amp;New_Datasets</code>:</p>
  
  <pre><code>%put &amp;New_Datasets;
  CDR Cog Mile Path
  </code></pre>
  
  <p>I tried to just use a data step like this:</p>
  
  <pre><code>data &amp;New_Datasets;
       set &amp;myfiles;
  run;
  </code></pre>
  
  <p>but that resulted in all of the observations of the four data sets referenced in <code>&amp;mylist</code> being combined and put into each of the four data sets referenced in <code>&amp;New_Datasets</code>, with the following output from the log:</p>
  
  <pre><code>NOTE: There were 1482 observations read from the data set CPO.CDR_2016JUN.
  NOTE: There were 1444 observations read from the data set CPO.COG_2016JUN.
  NOTE: There were 255 observations read from the data set CPO.MILE_2016JUN.
  NOTE: There were 7 observations read from the data set CPO.PATH_2016JUN.
  NOTE: The data set WORK.CDR has 3188 observations and 1580 variables.
  NOTE: The data set WORK.COG has 3188 observations and 1580 variables.
  NOTE: The data set WORK.MILE has 3188 observations and 1580 variables.
  NOTE: The data set WORK.PATH has 3188 observations and 1580 variables.
  </code></pre>
  
  <p>What I want to accomplish is to have the 1482 observations from <code>cpo.cdr_2016jun</code> create a data set <code>work.cdr</code> with 1482 observations and so on, rather than having each of the new data sets be a combination of the ones referenced in the set statement. Any help would be greatly appreciated, thanks!</p>