<?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 Combining tables by row numbers in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78701#M256458</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to combine two data tables as below: DATA table1; INPUT&amp;nbsp; Time Results; Lines; 0&amp;nbsp; 255&amp;nbsp; 6&amp;nbsp; 263&amp;nbsp; 12&amp;nbsp; 236&amp;nbsp; 18&amp;nbsp; 233&amp;nbsp; ; RUN; DATA table2; INPUT&amp;nbsp; Time Results_2; Lines; 0&amp;nbsp; 250&amp;nbsp; 6&amp;nbsp; 237&amp;nbsp; 12&amp;nbsp; 233&amp;nbsp; 18&amp;nbsp; 234&amp;nbsp; ; RUN; The output that I need is as below: Time Results Time Results 0 255 0 250 6 263 6 237 12 236 12 233 18 233 18 234 The usual horizontal concatenation procedures such as MERGE and SET would combine the Time column.&amp;nbsp; If need to simply paste together the tables side-by-side, by row numbers (in general, I can have more than 2 data sets and may not have the same number of rows), how can I do that? Thanks, -Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Sep 2013 13:10:47 GMT</pubDate>
    <dc:creator>RichardM</dc:creator>
    <dc:date>2013-09-11T13:10:47Z</dc:date>
    <item>
      <title>Combining tables by row numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78701#M256458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to combine two data tables as below: DATA table1; INPUT&amp;nbsp; Time Results; Lines; 0&amp;nbsp; 255&amp;nbsp; 6&amp;nbsp; 263&amp;nbsp; 12&amp;nbsp; 236&amp;nbsp; 18&amp;nbsp; 233&amp;nbsp; ; RUN; DATA table2; INPUT&amp;nbsp; Time Results_2; Lines; 0&amp;nbsp; 250&amp;nbsp; 6&amp;nbsp; 237&amp;nbsp; 12&amp;nbsp; 233&amp;nbsp; 18&amp;nbsp; 234&amp;nbsp; ; RUN; The output that I need is as below: Time Results Time Results 0 255 0 250 6 263 6 237 12 236 12 233 18 233 18 234 The usual horizontal concatenation procedures such as MERGE and SET would combine the Time column.&amp;nbsp; If need to simply paste together the tables side-by-side, by row numbers (in general, I can have more than 2 data sets and may not have the same number of rows), how can I do that? Thanks, -Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 13:10:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78701#M256458</guid>
      <dc:creator>RichardM</dc:creator>
      <dc:date>2013-09-11T13:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Combining tables by row numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78702#M256459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, my post scrambled the data format.&amp;nbsp; The output that I need is below.&amp;nbsp; How can I do that if I have two separate tables (each having two columns of Time and Results) and I need to paste them together side-by-side?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="256"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="19" width="64"&gt;Time&lt;/TD&gt;&lt;TD width="64"&gt;Results&lt;/TD&gt;&lt;TD width="64"&gt;Time&lt;/TD&gt;&lt;TD width="64"&gt;Results&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="19"&gt;0&lt;/TD&gt;&lt;TD align="right"&gt;255&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right"&gt;250&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="19"&gt;6&lt;/TD&gt;&lt;TD align="right"&gt;263&lt;/TD&gt;&lt;TD align="right"&gt;6&lt;/TD&gt;&lt;TD align="right"&gt;237&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="19"&gt;12&lt;/TD&gt;&lt;TD align="right"&gt;236&lt;/TD&gt;&lt;TD align="right"&gt;12&lt;/TD&gt;&lt;TD align="right"&gt;233&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="19"&gt;18&lt;/TD&gt;&lt;TD align="right"&gt;233&lt;/TD&gt;&lt;TD align="right"&gt;18&lt;/TD&gt;&lt;TD align="right"&gt;234&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 13:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78702#M256459</guid>
      <dc:creator>RichardM</dc:creator>
      <dc:date>2013-09-11T13:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Combining tables by row numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78703#M256460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you can modify the tables to include an actual rownumber variable then just merge by that.&lt;/P&gt;&lt;P&gt;Otherwise you can work a little harder and get SAS to do it from the original data sets.&lt;/P&gt;&lt;P&gt;Make sure that the variable names are unique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data table1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;input time1 result1 @@;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;0 255 6 263 12 236 18 233&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data table2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;input time2 result2 @@;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;0 250 6 237 18 234&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want1 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if (eof1 and eof2) then stop;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if not eof1 then set table1 end=eof1 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if not eof2 then set table2 end=eof2 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; call missing(of _all_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; time1&amp;nbsp;&amp;nbsp;&amp;nbsp; result1&amp;nbsp;&amp;nbsp;&amp;nbsp; time2&amp;nbsp;&amp;nbsp;&amp;nbsp; result2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 255&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 250&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 263&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 237&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 236&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 234&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 13:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78703#M256460</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-09-11T13:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Combining tables by row numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78704#M256461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Tom!&amp;nbsp; The command using eof worked for my application.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 18:41:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78704#M256461</guid>
      <dc:creator>RichardM</dc:creator>
      <dc:date>2013-09-11T18:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Combining tables by row numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78705#M256462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you could merge the two tables without by variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;merge table1 table2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 20:03:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78705#M256462</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-09-11T20:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Combining tables by row numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78706#M256463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Linlin.&amp;nbsp; I initially tried what you suggested using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;merge table1 table2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but without giving distinct column names for Results, it does not work the way I need it.&amp;nbsp; With distinct names, then it does work.&amp;nbsp; Now I know two methods to do this - the usual merge command and the eof commands Tom suggested.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 20:18:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78706#M256463</guid>
      <dc:creator>RichardM</dc:creator>
      <dc:date>2013-09-11T20:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Combining tables by row numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78707#M256464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you need to rename the variables:&lt;/P&gt;&lt;P&gt;data table1;&lt;BR /&gt;input time result @@;&lt;BR /&gt;cards;&lt;BR /&gt;0 255 6 263 12 236 18 233&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data table2;&lt;BR /&gt;input time result @@;&lt;BR /&gt;cards;&lt;BR /&gt;0 250 6 237 18 234&lt;BR /&gt;run;&lt;BR /&gt;data want;&lt;BR /&gt;merge table1(rename=(time=time1 result=result1)) table2(rename=(time=time2 result=result2)) ;&lt;BR /&gt;run;&lt;BR /&gt;proc print;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 20:43:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-tables-by-row-numbers/m-p/78707#M256464</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-09-11T20:43:26Z</dc:date>
    </item>
  </channel>
</rss>

