<?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: How to maintain the row order after joining? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-maintain-the-row-order-after-joining/m-p/296001#M61936</link>
    <description>&lt;P&gt;You can't by default. If you have a variable you can sort by add that your order by statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't have a sort var you'll have to create one.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2016 20:38:01 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-09-01T20:38:01Z</dc:date>
    <item>
      <title>How to maintain the row order after joining?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-maintain-the-row-order-after-joining/m-p/295999#M61935</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am joining two tables, testA, testB.code is as below, but how can I maintain the order of column name value, as H C D, instead of C D H after joining? Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data testA;&lt;BR /&gt;input name $ number;&lt;BR /&gt;datalines;&lt;BR /&gt;H 4&lt;BR /&gt;C 7&lt;BR /&gt;D 9&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data testB;&lt;BR /&gt;input name $ class;&lt;BR /&gt;datalines;&lt;BR /&gt;H 88&lt;BR /&gt;C 99&lt;BR /&gt;D 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table final as&lt;BR /&gt;select a.*,b.* from testA a left join testB b on a.name=b.name;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 20:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-maintain-the-row-order-after-joining/m-p/295999#M61935</guid>
      <dc:creator>zhangda</dc:creator>
      <dc:date>2016-09-01T20:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to maintain the row order after joining?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-maintain-the-row-order-after-joining/m-p/296001#M61936</link>
      <description>&lt;P&gt;You can't by default. If you have a variable you can sort by add that your order by statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't have a sort var you'll have to create one.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 20:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-maintain-the-row-order-after-joining/m-p/296001#M61936</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-01T20:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to maintain the row order after joining?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-maintain-the-row-order-after-joining/m-p/296002#M61937</link>
      <description>&lt;P&gt;One way to implement &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;'s suggestion:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data testA;
input name $ number;
&lt;STRONG&gt;order = _n_;&lt;/STRONG&gt;
datalines;
H 4
C 7
D 9
;
run;

data testB;
input name $ class;
datalines;
H 88
C 99
D 0
;
run;

proc sql;
create table final as
select a.*,b.* from testA a left join testB b on a.name=b.name
order by order;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Sep 2016 20:51:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-maintain-the-row-order-after-joining/m-p/296002#M61937</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-01T20:51:12Z</dc:date>
    </item>
  </channel>
</rss>

