<?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: Append Multiple tabes in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503638#M852</link>
    <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;It woks perfectly!!&lt;/P&gt;</description>
    <pubDate>Fri, 12 Oct 2018 07:49:07 GMT</pubDate>
    <dc:creator>AnaC</dc:creator>
    <dc:date>2018-10-12T07:49:07Z</dc:date>
    <item>
      <title>Append Multiple tabes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503439#M825</link>
      <description>&lt;P&gt;Hello everybody&lt;/P&gt;&lt;P&gt;I usualy use Guide to work but to be able to go a litte furter on my work I'm doing some steps in SAS Base (inside Guide). I've been looking for a solution that permits to append a variable number of tables - like in a loop/do while/etc. cicle. What I have today is a manual step by step process:&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;data STUDY;

set

     STUDY_0

     STUDY_1

     STUDY_2

     STUDY_3

     STUDY_4

   (AND SO ON...);　


run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;If I need to add more tables I have to do it maualy.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Does anyone know a way to go arround this? I thought in someting like:&lt;/FONT&gt;&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 doappendtable(a=);

%do d=0 %to &amp;amp;a.;

 STUDY_&amp;amp;d.;

%end;

run;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;CODE class=" language-sas"&gt;%doappnedtable(a=4);&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 15:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503439#M825</guid>
      <dc:creator>AnaC</dc:creator>
      <dc:date>2018-10-11T15:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Append Multiple tabes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503441#M826</link>
      <description>&lt;P&gt;If you want ALL of the data set names that start with STUDY_ you could use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set study_: ;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 15:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503441#M826</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-11T15:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Append Multiple tabes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503442#M827</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro doappendtable(a=);
%do d=0 %to &amp;amp;a.;
 STUDY_&amp;amp;d.     
%end;
%mend;

data study;
    set %doappendtable(a=4);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Don't forget the semi-colon after calling the macro. And no semi-colon as in your original code after STUDY_&amp;amp;D&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 15:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503442#M827</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-10-11T15:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Append Multiple tabes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503638#M852</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;It woks perfectly!!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2018 07:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503638#M852</guid>
      <dc:creator>AnaC</dc:creator>
      <dc:date>2018-10-12T07:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Append Multiple tabes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503639#M853</link>
      <description>&lt;P&gt;The semi.colon issue is very importante. Otherwise I was almost there &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thnaks once more guys.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2018 07:52:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503639#M853</guid>
      <dc:creator>AnaC</dc:creator>
      <dc:date>2018-10-12T07:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Append Multiple tabes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503676#M860</link>
      <description>&lt;P&gt;So here's something to think about when or if you try writing another macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macros are simply used to substitute text into your SAS program. Where you actually see macro variables or macro code in your program, the text values created by the macro code are substituted into SAS when you execute your program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And when this substitution happens, it must result in valid legal SAS code with no errors, and obviously, the code must do what you want. That's so important, I'm going to say it again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;when this substitution happens, it must result in valid legal SAS code with no errors&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if your original code has&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; STUDY_&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;d&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then when &amp;amp;d is 1, the text placed into the code when SAS executes is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;STUDY_1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and the semi-colon is wrong if you are expecting to add additional data set names to the SET statement. Why? Because the result would be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SET STUDY_1; STUDY_2; STUDY_3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and this will produce errors.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2018 11:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-Multiple-tabes/m-p/503676#M860</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-10-12T11:55:33Z</dc:date>
    </item>
  </channel>
</rss>

