<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Merging Files Automatically in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38388#M7694</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to pull data from several datasets into one. The following code works perfectly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Final;&lt;BR /&gt;Set &lt;BR /&gt;D3 D4 D5 D6 D7 D8 D9 D10; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="mcePaste" id="_mcePaste" style="position: absolute; width: 1px; height: 1px; overflow: hidden; top: 0px; left: -10000px;"&gt;﻿&lt;/DIV&gt;&lt;P&gt;As the number of datasets changes each time, I wonder if there is a way to call them in one step (similar to Array D3-D10).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is not possible, is there a way to use a macro...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;JAR&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Jul 2011 13:04:40 GMT</pubDate>
    <dc:creator>JAR</dc:creator>
    <dc:date>2011-07-28T13:04:40Z</dc:date>
    <item>
      <title>Merging Files Automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38388#M7694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to pull data from several datasets into one. The following code works perfectly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Final;&lt;BR /&gt;Set &lt;BR /&gt;D3 D4 D5 D6 D7 D8 D9 D10; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="mcePaste" id="_mcePaste" style="position: absolute; width: 1px; height: 1px; overflow: hidden; top: 0px; left: -10000px;"&gt;﻿&lt;/DIV&gt;&lt;P&gt;As the number of datasets changes each time, I wonder if there is a way to call them in one step (similar to Array D3-D10).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is not possible, is there a way to use a macro...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;JAR&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 13:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38388#M7694</guid>
      <dc:creator>JAR</dc:creator>
      <dc:date>2011-07-28T13:04:40Z</dc:date>
    </item>
    <item>
      <title>Merging Files Automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38389#M7695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I read that is possible in 9.3&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 13:18:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38389#M7695</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-28T13:18:23Z</dc:date>
    </item>
    <item>
      <title>Merging Files Automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38390#M7696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Of course, even without 9.3, you could always use something like:&lt;/P&gt;&lt;P&gt;data d1;&lt;/P&gt;&lt;P&gt; x=1;&lt;/P&gt;&lt;P&gt; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data d2;&lt;/P&gt;&lt;P&gt; x=2;&lt;/P&gt;&lt;P&gt; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data all;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set d:;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 13:20:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38390#M7696</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-28T13:20:50Z</dc:date>
    </item>
    <item>
      <title>Merging Files Automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38391#M7697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And, while I had never tried it, it works in 9.2 as well:&lt;/P&gt;&lt;P&gt;data all;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set d1-d2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I must have read is the new ability to do the same thing in the data statement itself.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 13:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38391#M7697</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-28T13:22:32Z</dc:date>
    </item>
    <item>
      <title>Merging Files Automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38392#M7698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I am using learner's edition of Enterprise Guide. The engine is still 9.1, your code does not work in it:&lt;/P&gt;&lt;P&gt;data all;&lt;/P&gt;&lt;P&gt;set d1-d2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;JAR&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 14:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38392#M7698</guid>
      <dc:creator>JAR</dc:creator>
      <dc:date>2011-07-28T14:03:00Z</dc:date>
    </item>
    <item>
      <title>Merging Files Automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38393#M7699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could always approximate it using a combination of proc sql and a datastep. E.g.,:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select memname into : files&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; separated by " "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.tables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname like 'D%'&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set &amp;amp;files.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 14:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38393#M7699</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-28T14:14:55Z</dc:date>
    </item>
    <item>
      <title>Merging Files Automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38394#M7700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This should work as well:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro combine;&lt;/P&gt;&lt;P&gt;data final;&lt;/P&gt;&lt;P&gt;set&lt;/P&gt;&lt;P&gt;%do i=3 %to 10;&lt;/P&gt;&lt;P&gt;d&amp;amp;i&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%combine;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="font-family: Courier New; color: #000080; font-size: 10pt;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 14:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38394#M7700</guid>
      <dc:creator>ieva</dc:creator>
      <dc:date>2011-07-28T14:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Files Automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38395#M7701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ... as more and more data sets get added, would PROC APPEND be faster for concatenating data sets ...&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%macro fakedata;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%do j=1 %to 10;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data d&amp;amp;j;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do j=1 to 1e6;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%mend;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;* make 10 data sets ... d1 through d10;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%fakedata;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do ds=1 to 10;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; call execute(catt('proc append base=final data=d',ds,';run;'));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-size: 13px;"&gt;&lt;SPAN style="font-size: 10pt; color: #008080; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #008080; font-family: 'Courier New';"&gt; &lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 15:03:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38395#M7701</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2011-07-28T15:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Files Automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38396#M7702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interestingly, yes, proc append (and/or probably using append in proc datasets) is quite a bit more efficient.&amp;nbsp; I wonder why the same operation uses a different algorithm in a datastep.&amp;nbsp; There shouldn't be any need to re-read each file when appending additional files, but the processing time indicates otherwise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 15:29:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38396#M7702</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-28T15:29:43Z</dc:date>
    </item>
    <item>
      <title>Merging Files Automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38397#M7703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;APPEND is a specialized tool, and that allows a degree of optimization (block operations, etc.). The DATA step is a very flexible thing, but at a cost. It drags all of the data, an observation at a time, through the program data vector. That adds overhead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm pretty sure there's no re-reading. That would have to be deliberately contrived.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also: OPEN=DEFER may help in the DATA step, if the data sets meet the requirements.&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;art297 wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interestingly, yes, proc append (and/or probably using append in proc datasets) is quite a bit more efficient.&amp;nbsp; I wonder why the same operation uses a different algorithm in a datastep.&amp;nbsp; There shouldn't be any need to re-read each file when appending additional files, but the processing time indicates otherwise.&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 21:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Files-Automatically/m-p/38397#M7703</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2011-07-28T21:12:35Z</dc:date>
    </item>
  </channel>
</rss>

