<?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: Concatenate macro created datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-macro-created-datasets/m-p/436484#M108544</link>
    <description>&lt;P&gt;Modify your other macro to have the number at the end of the variable name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;Work&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;Number_result_&amp;amp;j&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can use the shortcut reference in the SET statement and no macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: This post was posted incorrectly, but&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Feb 2018 22:29:55 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-02-12T22:29:55Z</dc:date>
    <item>
      <title>Concatenate macro created datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-macro-created-datasets/m-p/436480#M108540</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a beginner and I have thousands of result data sets with similar 3 variables of Company Name, Return 1 and return 2, I would like to concatenate (as in merge vertically) all of them into one base file with no order required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the following macro to&amp;nbsp;merge them, but there seems to be many repeated observations. I have looked&amp;nbsp;into this a long time but have not found the solution, I would really appreciate any suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mergeresult(b=1);
%local j;
%do j = 1 %to &amp;amp;b;
data Work.BaseResult;
set Work.BaseResult Work.Number_&amp;amp;j._result;
run;
%end;
%mend;&lt;BR /&gt;%mergeresult(b=1000);&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 22:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-macro-created-datasets/m-p/436480#M108540</guid>
      <dc:creator>KrisDeng</dc:creator>
      <dc:date>2018-02-12T22:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate macro created datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-macro-created-datasets/m-p/436483#M108543</link>
      <description>&lt;P&gt;This program is a good example of why you should focus first on SAS language, and wait until later to learn macro language.&amp;nbsp; This program runs for approximately 500 times as long as it needs to.&amp;nbsp; For example, you are running 1,000 DATA steps.&amp;nbsp; Each one has to read in then output the contents of NUMBER_1_RESULT data.&amp;nbsp; A better construction for the interior of the macro would look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc append base=work.BaseResult data=Work.Number_&amp;amp;j._Result;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This program will also generate an error if the structure of one of the data sets is different than what you are expecting.&amp;nbsp; In this case, that would be a good result to point out differences instead of letting you combine that data set with the others.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 22:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-macro-created-datasets/m-p/436483#M108543</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-12T22:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate macro created datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-macro-created-datasets/m-p/436484#M108544</link>
      <description>&lt;P&gt;Modify your other macro to have the number at the end of the variable name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;Work&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;Number_result_&amp;amp;j&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can use the shortcut reference in the SET statement and no macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: This post was posted incorrectly, but&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 22:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-macro-created-datasets/m-p/436484#M108544</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-12T22:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate macro created datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-macro-created-datasets/m-p/436488#M108547</link>
      <description>&lt;P&gt;Thank you for your very much appreciated advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: The code works perfectly. My bad for placing wrong syntax hence the errors. Thank you very much!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 22:25:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-macro-created-datasets/m-p/436488#M108547</guid>
      <dc:creator>KrisDeng</dc:creator>
      <dc:date>2018-02-12T22:25:44Z</dc:date>
    </item>
  </channel>
</rss>

