<?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 the result datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Append-the-result-datasets/m-p/791626#M253607</link>
    <description>&lt;P&gt;Hello team member,&lt;/P&gt;
&lt;P&gt;I understood the first part only, that is enough for me for now. I will come back to this later.&amp;nbsp;&lt;BR /&gt;Blue &amp;amp; Black&lt;/P&gt;</description>
    <pubDate>Sat, 22 Jan 2022 03:25:54 GMT</pubDate>
    <dc:creator>GN0001</dc:creator>
    <dc:date>2022-01-22T03:25:54Z</dc:date>
    <item>
      <title>Append the result datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-the-result-datasets/m-p/790617#M253150</link>
      <description>&lt;PRE&gt;/* data1, data2, data3, data4*/


%let readFrom = data1;

data thisdata;
set &amp;amp;readfrom;
run;

&lt;/PRE&gt;
&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;On the code on the top, The macro variable readFrom reads from data1, data2, data3 and data4. Each time we replace readfrom variable macro with data1, data2, data3 and data4&lt;/P&gt;
&lt;P&gt;I want to save the result thisdata&amp;nbsp;in a table , which is read from data1 and then append to it&amp;nbsp; thisdata when readfrom variable is replaced by data2.&lt;/P&gt;
&lt;P&gt;We keep the result data1, then append to it data2, then data3 and data4.&lt;/P&gt;
&lt;P&gt;Any help is greatly appreciated.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&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;</description>
      <pubDate>Tue, 18 Jan 2022 03:43:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-the-result-datasets/m-p/790617#M253150</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-01-18T03:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Append the result datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-the-result-datasets/m-p/790618#M253151</link>
      <description>&lt;P&gt;Don't think you need macro variables for that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data thisdata;
set data1 - data4;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jan 2022 03:52:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-the-result-datasets/m-p/790618#M253151</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-01-18T03:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Append the result datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-the-result-datasets/m-p/790666#M253168</link>
      <description>&lt;P&gt;Unless you do something special with the data first, you can just read them in one fell swoop:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let readfrom=data1 data2 data3 data_Test data_OK;
data thisdata;
set &amp;amp;readfrom;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if you need to do something special with each input data set first, you may want to do something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro read_data(readfrom,out=final_output);
  %local i;
  %if %sysfunc(exist(&amp;amp;out)) %then %do;
    proc delete data=&amp;amp;out;run;
    %end;
   %do i=1 %to %sysfunc(countw(&amp;amp;readfrom));
      data temp_out;
          set %scan(&amp;amp;readfrom,&amp;amp;i);
      run;
      /* You will probably have more processing here, in this case */&lt;BR /&gt;      &lt;BR /&gt;      /* if BASE dataset does not exist, the input is just copied, no problem */
      proc append data=temp_out base=&amp;amp;out;
      run;
      %end;
%mend;

%read_data(&amp;amp;readfrom);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jan 2022 11:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-the-result-datasets/m-p/790666#M253168</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2022-01-18T11:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Append the result datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-the-result-datasets/m-p/791626#M253607</link>
      <description>&lt;P&gt;Hello team member,&lt;/P&gt;
&lt;P&gt;I understood the first part only, that is enough for me for now. I will come back to this later.&amp;nbsp;&lt;BR /&gt;Blue &amp;amp; Black&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 03:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-the-result-datasets/m-p/791626#M253607</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-01-22T03:25:54Z</dc:date>
    </item>
  </channel>
</rss>

