<?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 order by in subquery?? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/order-by-in-subquery/m-p/15483#M2721</link>
    <description>hi all,&lt;BR /&gt;
why is it not possible to order in subquery ??&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 create table test as&lt;BR /&gt;
 select *&lt;BR /&gt;
 from (select * from sashelp.class order by sex, age ); &lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
GR,&lt;BR /&gt;
Herman</description>
    <pubDate>Mon, 06 Apr 2009 10:10:04 GMT</pubDate>
    <dc:creator>Jaheuk</dc:creator>
    <dc:date>2009-04-06T10:10:04Z</dc:date>
    <item>
      <title>order by in subquery??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/order-by-in-subquery/m-p/15483#M2721</link>
      <description>hi all,&lt;BR /&gt;
why is it not possible to order in subquery ??&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 create table test as&lt;BR /&gt;
 select *&lt;BR /&gt;
 from (select * from sashelp.class order by sex, age ); &lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
GR,&lt;BR /&gt;
Herman</description>
      <pubDate>Mon, 06 Apr 2009 10:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/order-by-in-subquery/m-p/15483#M2721</guid>
      <dc:creator>Jaheuk</dc:creator>
      <dc:date>2009-04-06T10:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: order by in subquery??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/order-by-in-subquery/m-p/15484#M2722</link>
      <description>I never heard of this one. It seems very weird. Cannot find any doc that hints of this restriction in use of sub-queries. I suggest that open a track to SAS support to get an explanation.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Tue, 07 Apr 2009 12:24:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/order-by-in-subquery/m-p/15484#M2722</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-04-07T12:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: order by in subquery??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/order-by-in-subquery/m-p/15485#M2723</link>
      <description>In this case your  FROM Clause is a query expression&lt;BR /&gt;
 where the (query-expression) is an in-line view&lt;BR /&gt;
&lt;BR /&gt;
According to the documentation &lt;BR /&gt;
In-Line Views&lt;BR /&gt;
&lt;BR /&gt;
The FROM clause can itself contain a query-expression that takes an optional table alias. This kind of nested query-expression is called an in-line view. An in-line view is any query-expression that would be valid in a CREATE VIEW statement. ......&lt;BR /&gt;
&lt;BR /&gt;
Characteristics of in-line views include the following:&lt;BR /&gt;
􀀀 An in-line view is not assigned a permanent name, although it can take an alias.&lt;BR /&gt;
􀀀 An in-line view can be referred to only in the query in which it is defined. It&lt;BR /&gt;
cannot be referenced in another query.&lt;BR /&gt;
􀀀 You cannot use an ORDER BY clause in an in-line view.....&lt;BR /&gt;
&lt;BR /&gt;
For more information see &lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/PDF/default/proc.pdf" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/PDF/default/proc.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
To fix the problem change your query to&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table test as&lt;BR /&gt;
select *&lt;BR /&gt;
from (select * from sashelp.class) order by sex, age ; &lt;BR /&gt;
QUIT;</description>
      <pubDate>Tue, 07 Apr 2009 23:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/order-by-in-subquery/m-p/15485#M2723</guid>
      <dc:creator>LAP</dc:creator>
      <dc:date>2009-04-07T23:59:16Z</dc:date>
    </item>
  </channel>
</rss>

