<?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: Vertiacally combine dataset based on sequential number which increments from 1 upwards. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881845#M348450</link>
    <description>&lt;P&gt;Thanks for your reply. Do you know how to connect to hive tables (hadoop) from SAS and do the same&amp;nbsp; in HIVE QL&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jun 2023 06:34:34 GMT</pubDate>
    <dc:creator>Sathya3</dc:creator>
    <dc:date>2023-06-22T06:34:34Z</dc:date>
    <item>
      <title>Vertiacally combine dataset based on sequential number which increments from 1 upwards.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881641#M348353</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Hi ,&lt;BR /&gt;I have a requirement where I have to combine tables using union all.&lt;BR /&gt;List of source tables are like Table_1, Table_2...so on till table_n where n is not a fixed number and &lt;BR /&gt;it is a sequential number from 1 upwards&lt;BR /&gt;My problem here is How to identify the final value of n (since it changes from time to time) &lt;BR /&gt;and vertically combine datasets with n suffixed to them &lt;BR /&gt;&lt;BR /&gt;Below is sample code :&lt;BR /&gt;&lt;BR /&gt;data table_1;
aaa
bbb
run;

data table_2;
aa
bb
run;

data table_3;
a
b
c
run;

Proc sq1;
create table final as 
select * from table_1
union all
select * from table_2
union all
select * from table_3
union all;
quit;
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 05:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881641#M348353</guid>
      <dc:creator>Sathya3</dc:creator>
      <dc:date>2023-06-21T05:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Vertiacally combine dataset based on sequential number which increments from 1 upwards.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881642#M348354</link>
      <description>Why not :&lt;BR /&gt;&lt;BR /&gt;data final ;&lt;BR /&gt; set table_: ;&lt;BR /&gt;run;</description>
      <pubDate>Wed, 21 Jun 2023 05:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881642#M348354</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-06-21T05:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Vertiacally combine dataset based on sequential number which increments from 1 upwards.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881645#M348356</link>
      <description>&lt;P&gt;How do I list table names in set statement when value of n is not fixed . n is a sequential number which increments from1&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 05:56:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881645#M348356</guid>
      <dc:creator>Sathya3</dc:creator>
      <dc:date>2023-06-21T05:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Vertiacally combine dataset based on sequential number which increments from 1 upwards.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881647#M348358</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;showed the answer of your question already : ":" works as a wildcard so all tables starting with "table_" will be used to create the result. I made your example runable so you may test it:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data table_1;
length value $10.;
input value;
datalines;
aaa
bbb
;
run;

data table_2;
length value $10.;
input value;
datalines;
aa
bb
;
run;

data table_3;
length value $10.;
input value;
datalines;
a
b
c
;
run;
data final ;
set table_: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jun 2023 06:44:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881647#M348358</guid>
      <dc:creator>HenryKobus</dc:creator>
      <dc:date>2023-06-21T06:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Vertiacally combine dataset based on sequential number which increments from 1 upwards.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881659#M348365</link>
      <description>&lt;P&gt;You can sort the table name by DICTIONARY table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table_1;
length value $10.;
input value;
datalines;
aaa
bbb
;
run;

data table_2;
length value $10.;
input value;
datalines;
aa
bb
;
run;

data table_3;
length value $10.;
input value;
datalines;
aaa
bbb
;
run;

data table_22;
length value $10.;
input value;
datalines;
aa
bb
;
run;

data table_11;
length value $10.;
input value;
datalines;
a
b
c
;
run;

proc sql noprint;
select memname into :list separated by ' '
 from dictionary.tables
  where libname='WORK' and memname like 'TABLE%'   /*&amp;lt;--- must be capital */
   order by input(compress(memname,,'kd'),best.);
quit;



data final ;
set &amp;amp;list. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jun 2023 08:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881659#M348365</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-06-21T08:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Vertiacally combine dataset based on sequential number which increments from 1 upwards.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881845#M348450</link>
      <description>&lt;P&gt;Thanks for your reply. Do you know how to connect to hive tables (hadoop) from SAS and do the same&amp;nbsp; in HIVE QL&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 06:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881845#M348450</guid>
      <dc:creator>Sathya3</dc:creator>
      <dc:date>2023-06-22T06:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Vertiacally combine dataset based on sequential number which increments from 1 upwards.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881847#M348451</link>
      <description>&lt;P&gt;You can also do it the "lazy way" using the noDSMFERR option:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table_1 table_2 table_3 table_7;
length value $10.;
input value;
datalines;
aaa
bbb
;
run;

data table_22 table_11;
length value $10.;
input value;
datalines;
aa
bb
;
run;

data table_112 table_897;
length value $10.;
input value;
datalines;
a
b
c
;
run;



option noDSNFERR;
data final ;
  set table_1-table_9 table_10-table_99 table_100-table_999 /* ... add more if needed */ indsname=in;
  indsname=in; /* &amp;lt;- this variable keeps data set name */
run;
option DSNFERR;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;All the best&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 07:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vertiacally-combine-dataset-based-on-sequential-number-which/m-p/881847#M348451</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-06-22T07:09:54Z</dc:date>
    </item>
  </channel>
</rss>

