<?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: sas union in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-union/m-p/346685#M79972</link>
    <description>&lt;P&gt;Planck,&lt;/P&gt;&lt;P&gt;It is very hard to tell what is wrong with your code when we do not know what the %MACRO1 macro is supposed to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you say it is running for a very long time without answers. does that mean that you never see the "source2" code in the log? In that case it seems to mean that the first call of %MACRO1 is somehow stuck and just hangs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What happens if you open the generated program in an editor and submit line by line? That is the great advantage of generating a file instead of using CALL EXECUTE or such: when developing/testing, you can take a good, long look at the generated code before submitting it, and you can submit it one step at a time and check the output before you proceed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, you put the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  put '%union(partnumber = ' nb')' ;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;after the "stop;" statement in your datastep, meaning that it does not get written to the code file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Søren&lt;/P&gt;</description>
    <pubDate>Mon, 03 Apr 2017 14:32:27 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2017-04-03T14:32:27Z</dc:date>
    <item>
      <title>sas union</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-union/m-p/346597#M79951</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;filename code temp;
data C;
  set A nobs=nobs ;
  file code ;
  do part=0 to int(nobs/1000);
     put '%macro1(inputtable=A, outputtable = B_P, size=1000,part=' part')' ;
  end;
  stop;
run;
%include code / source2 ;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table A which create several B tables named B_P0, B_P2,...,B_P(n-1)&lt;/P&gt;&lt;P&gt;I would like to create in the same datastep the table C as an union of all B_P tables, and then delete B_P tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 08:43:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-union/m-p/346597#M79951</guid>
      <dc:creator>Planck</dc:creator>
      <dc:date>2017-04-03T08:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: sas union</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-union/m-p/346622#M79958</link>
      <description>&lt;P&gt;I tried to do something like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro union(partnumber);
data C; set B_P0; run;
%do part=1 %to &amp;amp;partnumber;
PROC APPEND BASE= C DATA= B_P.part; RUN;
%end;
%mend;

filename code temp;
data _null_;
  set A nobs=nobs ;
  file code ;
  nb = int(nobs/1000);
  do part=0 to int(nobs/1000);
     put '%macro1(inputtable=A, outputtable = B_P, size=1000,part=' part')' ;
  end;
  stop;
  put '%union(partnumber = ' nb')' ;
run;
%include code / source2 ;&lt;/PRE&gt;&lt;P&gt;But apparantly it is not working. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is running for a very long time without answers.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 10:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-union/m-p/346622#M79958</guid>
      <dc:creator>Planck</dc:creator>
      <dc:date>2017-04-03T10:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: sas union</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-union/m-p/346685#M79972</link>
      <description>&lt;P&gt;Planck,&lt;/P&gt;&lt;P&gt;It is very hard to tell what is wrong with your code when we do not know what the %MACRO1 macro is supposed to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you say it is running for a very long time without answers. does that mean that you never see the "source2" code in the log? In that case it seems to mean that the first call of %MACRO1 is somehow stuck and just hangs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What happens if you open the generated program in an editor and submit line by line? That is the great advantage of generating a file instead of using CALL EXECUTE or such: when developing/testing, you can take a good, long look at the generated code before submitting it, and you can submit it one step at a time and check the output before you proceed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, you put the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  put '%union(partnumber = ' nb')' ;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;after the "stop;" statement in your datastep, meaning that it does not get written to the code file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Søren&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 14:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-union/m-p/346685#M79972</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2017-04-03T14:32:27Z</dc:date>
    </item>
  </channel>
</rss>

