<?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 Proc SQL Ranking in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Ranking/m-p/605853#M175853</link>
    <description>&lt;P&gt;I have a table where I have an IDAGENT_IDAGENT_NAME, TEAM_LEAD_NM, DATE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use Proc SQL to generate a rank because the ID and NAME are duplicated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select AGENT_ID, AGENT_NAME, TEAM_LEAD_NM, rank() over (Partition by AGENT_LAN_ID&lt;BR /&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; &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; &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;order by sys_load_dtm desc) as RANK&lt;BR /&gt;from TABLE&lt;BR /&gt;where AGENT_NAME = 'Smith, John';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error i get is:&lt;/P&gt;&lt;P&gt;____&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN,&lt;BR /&gt;CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what is the proper syntac in PROC SQL to rank my data?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 17:46:38 GMT</pubDate>
    <dc:creator>Jyuen204</dc:creator>
    <dc:date>2019-11-20T17:46:38Z</dc:date>
    <item>
      <title>Proc SQL Ranking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Ranking/m-p/605853#M175853</link>
      <description>&lt;P&gt;I have a table where I have an IDAGENT_IDAGENT_NAME, TEAM_LEAD_NM, DATE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use Proc SQL to generate a rank because the ID and NAME are duplicated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select AGENT_ID, AGENT_NAME, TEAM_LEAD_NM, rank() over (Partition by AGENT_LAN_ID&lt;BR /&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; &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; &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;order by sys_load_dtm desc) as RANK&lt;BR /&gt;from TABLE&lt;BR /&gt;where AGENT_NAME = 'Smith, John';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error i get is:&lt;/P&gt;&lt;P&gt;____&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN,&lt;BR /&gt;CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what is the proper syntac in PROC SQL to rank my data?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 17:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Ranking/m-p/605853#M175853</guid>
      <dc:creator>Jyuen204</dc:creator>
      <dc:date>2019-11-20T17:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Ranking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Ranking/m-p/609546#M177479</link>
      <description>&lt;P&gt;If you absolutely want to use SQL, you must first sort the data and use the unsupported monotonic() function, and then use that data for subsequent processing.&lt;/P&gt;
&lt;P&gt;Feel free to vote &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/Add-window-functions-in-SAS-SQL/idi-p/462556" target="_self"&gt;here&lt;/A&gt; and &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/Create-ROW-NUMBER-function-for-PROC-SQL/idi-p/539954" target="_self"&gt;here&lt;/A&gt; to change this, if you think it makes a difference.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 21:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Ranking/m-p/609546#M177479</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-12-04T21:54:13Z</dc:date>
    </item>
  </channel>
</rss>

