<?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 Re: A Macro to merge data sets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-to-merge-data-sets/m-p/533210#M146168</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Accounts_FY18;

set Account _201801 - Account _201812;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 06 Feb 2019 13:19:38 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2019-02-06T13:19:38Z</dc:date>
    <item>
      <title>A Macro to merge data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-to-merge-data-sets/m-p/533151#M146140</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm here seeking help for a macro to merge tables with similar table structures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've written the below code but I believe a macro would be easy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Accounts_FY18;&lt;/P&gt;&lt;P&gt;set Account _201801&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Account&amp;nbsp;_201802&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account&amp;nbsp;_201803&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account&amp;nbsp;_201804&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account&amp;nbsp;_201805&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account&amp;nbsp;_201806&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account&amp;nbsp;_201807&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account&amp;nbsp;_201808&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Account&amp;nbsp;_201809&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Account&amp;nbsp;_201810&lt;/P&gt;&lt;P&gt;&amp;nbsp; Account&amp;nbsp;_201811&lt;/P&gt;&lt;P&gt;&amp;nbsp; Account&amp;nbsp;_201812;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Appreciate your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 06:57:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-to-merge-data-sets/m-p/533151#M146140</guid>
      <dc:creator>Timbim</dc:creator>
      <dc:date>2019-02-06T06:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: A Macro to merge data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-to-merge-data-sets/m-p/533152#M146141</link>
      <description>&lt;P&gt;Well, i would be a good starter to discuss why those 12 datasets have been created at all, that seems to be bad design.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now the good news: you don't need macro-code!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Accounts_FY18;
    set Account_2018:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This causes all datasets named like "Account_2018*" to be appended.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 07:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-to-merge-data-sets/m-p/533152#M146141</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-02-06T07:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: A Macro to merge data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-to-merge-data-sets/m-p/533175#M146150</link>
      <description>&lt;P&gt;Just to add to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp; great answer, use correct terminology.&amp;nbsp; You are not "merging" data, you are appending data.&amp;nbsp; There is a big difference.&lt;/P&gt;
&lt;P&gt;I would also agree strongly with the "&lt;SPAN&gt;why those 12 datasets", as this may also impact your processing.&amp;nbsp; If these datasets are large, then you may need to use the append procedure rather than the datastep approach, example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;data a1;
  a=1;
run;
data a2;
  a=2;
run;
data a3;
  a=3;
run;

data _null_;
  set sashelp.vtable (where=(libname="WORK" and char(memname,1)="A"));
  if _n_=1 then call execute(cats('data want; set work.',memname,';run;'));
  else call execute(cats('proc append base=want data=work.',memname,';run;'));
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Feb 2019 09:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-to-merge-data-sets/m-p/533175#M146150</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-06T09:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: A Macro to merge data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-to-merge-data-sets/m-p/533210#M146168</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Accounts_FY18;

set Account _201801 - Account _201812;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Feb 2019 13:19:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-to-merge-data-sets/m-p/533210#M146168</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-02-06T13:19:38Z</dc:date>
    </item>
  </channel>
</rss>

