<?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: Proc Sql - interpret a query in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-interpret-a-query/m-p/111553#M30928</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is an undocumented option _method, which may give you some idea. Here is an example:&lt;/P&gt;&lt;P style="font-family: Consolas, Courier New; font-size: 90%; line-height: 1.1;"&gt; &lt;BR /&gt; &lt;STRONG style="color: #000080;"&gt;proc&lt;/STRONG&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #000080;"&gt;sql&lt;/STRONG&gt;&lt;SPAN&gt; _method;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;select&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN&gt; name, max(age) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;as&lt;/SPAN&gt;&lt;SPAN&gt; maxAge&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;from&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; sashelp.class&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;group&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN&gt; sex;&lt;/SPAN&gt;&lt;BR /&gt; &lt;STRONG style="color: #000080;"&gt;quit&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;/* on log&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;NOTE: SQL execution methods chosen are:&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sqxslct&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sqxunqs&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;&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; sqxsumg&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;&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;&amp;nbsp; sqxsort&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sqxsrc( SASHELP.CLASS )&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jul 2012 16:08:44 GMT</pubDate>
    <dc:creator>chang_y_chung_hotmail_com</dc:creator>
    <dc:date>2012-07-19T16:08:44Z</dc:date>
    <item>
      <title>Proc Sql - interpret a query</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-interpret-a-query/m-p/111552#M30927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: navy;"&gt;&lt;STRONG&gt;Dear All,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: navy;"&gt;&lt;STRONG&gt;Could you please explain the order and particulars in which SAS 'actions', based on the below query? - perhaps with examples. I am interested when the groupping is done, if it's done several times, when the 'distinct' takes place and what this keyword actually does - in this context, what kind of rows it removes, if it's before or after the groupping is done...&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: navy;"&gt;&lt;STRONG&gt;Thank you very much in advance!&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: navy;"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: navy;"&gt;&lt;STRONG&gt;SQL&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;CREATE&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;TABLE&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; WORK.TABLE1 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;AS&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; t1.'Column1'n, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;(MAX(t1.Column2'n)) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'MAX Value'n&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;&amp;nbsp; (&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;CASE&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;WHEN&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; t1.'Column2'n = MAX(t1.'Column2'n) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;THEN&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; t1.'Column3'n &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;ELSE&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"" &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;END&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;AS&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; PL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; WORK.TEST &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;AS&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; t1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;GROUP&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;BY&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; t1.'Column1'n;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: navy;"&gt;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 13:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-interpret-a-query/m-p/111552#M30927</guid>
      <dc:creator>TimA</dc:creator>
      <dc:date>2012-07-19T13:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql - interpret a query</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-interpret-a-query/m-p/111553#M30928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is an undocumented option _method, which may give you some idea. Here is an example:&lt;/P&gt;&lt;P style="font-family: Consolas, Courier New; font-size: 90%; line-height: 1.1;"&gt; &lt;BR /&gt; &lt;STRONG style="color: #000080;"&gt;proc&lt;/STRONG&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #000080;"&gt;sql&lt;/STRONG&gt;&lt;SPAN&gt; _method;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;select&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN&gt; name, max(age) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;as&lt;/SPAN&gt;&lt;SPAN&gt; maxAge&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;from&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; sashelp.class&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;group&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN&gt; sex;&lt;/SPAN&gt;&lt;BR /&gt; &lt;STRONG style="color: #000080;"&gt;quit&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;/* on log&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;NOTE: SQL execution methods chosen are:&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sqxslct&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sqxunqs&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;&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; sqxsumg&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;&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;&amp;nbsp; sqxsort&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sqxsrc( SASHELP.CLASS )&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #008000;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 16:08:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-interpret-a-query/m-p/111553#M30928</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2012-07-19T16:08:44Z</dc:date>
    </item>
  </channel>
</rss>

