<?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 proc append in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786600#M251179</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;What is the way to write this code with proc append?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; Data ttt2101;
input id profit mon;
cards;
1 982 200 2101
2 978 400 2101
;
Run;

Data ttt2102;
input id profit mon;
cards;
1 982 250 2102
2 978 490 2102
;
Run;

Data ttt2105;
input id profit mon;
cards;
1 982 150 2105
2 978 300 2105
;
Run;

%let month_List=2101+2102+2105;
%let n=3;

%macro sset; 
%do j=1 %to &amp;amp;n.;
%let mon=%scan(&amp;amp;month_List.,&amp;amp;j.,+);
ttt&amp;amp;mon.
%end;
%mend sset;
%put %sset;

data ALL_tbl;
SET  %sset;
Run;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 18 Dec 2021 15:09:13 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2021-12-18T15:09:13Z</dc:date>
    <item>
      <title>proc append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786600#M251179</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;What is the way to write this code with proc append?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; Data ttt2101;
input id profit mon;
cards;
1 982 200 2101
2 978 400 2101
;
Run;

Data ttt2102;
input id profit mon;
cards;
1 982 250 2102
2 978 490 2102
;
Run;

Data ttt2105;
input id profit mon;
cards;
1 982 150 2105
2 978 300 2105
;
Run;

%let month_List=2101+2102+2105;
%let n=3;

%macro sset; 
%do j=1 %to &amp;amp;n.;
%let mon=%scan(&amp;amp;month_List.,&amp;amp;j.,+);
ttt&amp;amp;mon.
%end;
%mend sset;
%put %sset;

data ALL_tbl;
SET  %sset;
Run;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Dec 2021 15:09:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786600#M251179</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-12-18T15:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: proc append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786605#M251182</link>
      <description>&lt;P&gt;So, first, I want to say that no macros are needed here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all_tbl;
    set sset:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But since PROC APPEND is a better choice for when you have large data sets, you can do essentially the same macro looping as you are doing, and call PROC APPEND n times, where in this case n=3 because you have 3 data sets. As always, you should write the code without macros first and get that to work, and then the actual macro loop ought to be obvious. (Show us that code without macros if you are having trouble).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I recommend you go ahead and give writing such a macro a try, as it doesn't really seem to be difficult, or even that different, given your current looping. Show us what you have tried.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Dec 2021 15:40:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786605#M251182</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-18T15:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786626#M251195</link>
      <description>&lt;P&gt;Here's one way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let month_List=2101+2102+2105;
%let n=3;

%macro sset; 
%do j=1 %to &amp;amp;n.;
%let mon=%scan(&amp;amp;month_List.,&amp;amp;j.,+);
proc append data=ttt&amp;amp;mon.
 base=all_tbl;
run;
%end;
%mend sset;&lt;BR /&gt;%sset&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This assumes that the data set all_tbl does NOT already exist.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Dec 2021 23:11:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786626#M251195</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-12-18T23:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786634#M251202</link>
      <description>Sure but this method is a bit risky.&lt;BR /&gt;Need to be sure that there are no other datasets with same start...</description>
      <pubDate>Sun, 19 Dec 2021 06:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786634#M251202</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-12-19T06:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: proc append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786640#M251205</link>
      <description>&lt;PRE&gt;%let month_List=2101+2102+2105;
%let sset=ttt%sysfunc(prxchange(s/\+/ ttt/,-1, &amp;amp;month_List. ))  ;

%put &amp;amp;=sset. ;

data ALL_tbl;
SET  &amp;amp;sset. ;
Run;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Dec 2021 10:53:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append/m-p/786640#M251205</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-19T10:53:54Z</dc:date>
    </item>
  </channel>
</rss>

