<?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: SET multiuple data sets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766408#M242887</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks, may you please explain why way3 is incorrect?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Run the code.&lt;/P&gt;
&lt;P&gt;Read the error messages.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Sep 2021 14:58:04 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-09-07T14:58:04Z</dc:date>
    <item>
      <title>SET multiuple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766327#M242857</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I want to ask about concatenate data sets.&lt;/P&gt;
&lt;P&gt;What is the difference between Way2 and Way3 ?&lt;/P&gt;
&lt;P&gt;Is Way3 correct ?&lt;/P&gt;
&lt;P&gt;Is it essential to use macro with DO (Way2) ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data tbl1;
 input a;
cards;
1
2
3
;
run;

data tbl2;
input a;
cards;
4
5
6
;
run;


/*Way1*/
data wanted;
set tbl1 tbl2;
run;

/*Way2*/
%macro combine;
data wanted;
  set
  %do i = 1 %to 2;
   tbl&amp;amp;i
  %end;
  ;
run;
%mend;
%combine;

/*Way3*/
data wanted;
set
do i = 1 to 2;
tbl&amp;amp;i
end;
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Sep 2021 07:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766327#M242857</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-09-07T07:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: SET multiuple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766336#M242860</link>
      <description>&lt;P&gt;1 and 2 create identical code, so they are equivalent; 2 has the advantage that you can easily make the number of datasets dynamic.&lt;/P&gt;
&lt;P&gt;3 is syntactically incorrect and will never work.&lt;/P&gt;
&lt;P&gt;If you always have only two datasets, use method 1. Method 2 adds unneeded complexity that makes the code harder to maintain, in that case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I want to ask about concatenate data sets.&lt;/P&gt;
&lt;P&gt;What is the difference between Way2 and Way3 ?&lt;/P&gt;
&lt;P&gt;Is Way3 correct ?&lt;/P&gt;
&lt;P&gt;Is it essential to use macro with DO (Way2) ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data tbl1;
 input a;
cards;
1
2
3
;
run;

data tbl2;
input a;
cards;
4
5
6
;
run;


/*Way1*/
data wanted;
set tbl1 tbl2;
run;

/*Way2*/
%macro combine;
data wanted;
  set
  %do i = 1 %to 2;
   tbl&amp;amp;i
  %end;
  ;
run;
%mend;
%combine;

/*Way3*/
data wanted;
set
do i = 1 to 2;
tbl&amp;amp;i
end;
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 09:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766336#M242860</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-07T09:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: SET multiuple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766353#M242865</link>
      <description>Thanks, may you please explain why way3 is incorrect?&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Sep 2021 11:51:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766353#M242865</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-09-07T11:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: SET multiuple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766358#M242866</link>
      <description>&lt;P&gt;Already explained by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;who said it is syntactically incorrect. You cannot have DO in a SET statement.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 12:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766358#M242866</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-07T12:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: SET multiuple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766408#M242887</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks, may you please explain why way3 is incorrect?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Run the code.&lt;/P&gt;
&lt;P&gt;Read the error messages.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 14:58:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766408#M242887</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-09-07T14:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: SET multiuple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766423#M242893</link>
      <description>&lt;P&gt;If you have more than two of these numbered datasets then use a dataset list in the SET statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set tbl1-tbl5 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or the upper bound&amp;nbsp; for the number of dataset varies.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let n=5;
....
set tbl1-tbl&amp;amp;n;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Sep 2021 15:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766423#M242893</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-07T15:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: SET multiuple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766464#M242912</link>
      <description>&lt;P&gt;Or if you have "many" data sets with "non-sequential suffix" you can make it:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;set tbl: ;&lt;/LI-CODE&gt;
&lt;P&gt;so all data sets with the "tbl" prefix will be included.&lt;/P&gt;
&lt;P&gt;And by using the "indsname=" option you can get the name of all data set read int a variable:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data want;
  set tbl: indsname=indsname ;
  tbl_name = indsname;
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;All the best&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 19:11:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SET-multiuple-data-sets/m-p/766464#M242912</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-09-07T19:11:31Z</dc:date>
    </item>
  </channel>
</rss>

