<?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 rank in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478284#M123340</link>
    <description>&lt;P&gt;[ Erroneous post removed by jet-lagged author &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ]&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jul 2018 05:54:32 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-07-16T05:54:32Z</dc:date>
    <item>
      <title>proc rank</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478256#M123326</link>
      <description>&lt;P&gt;I have a dataset similar to&amp;nbsp;&lt;/P&gt;&lt;P&gt;data NATR332;&lt;BR /&gt;input Y1 Y2;&lt;BR /&gt;datalines;&lt;BR /&gt;146 141&lt;BR /&gt;141 143&lt;BR /&gt;135 139&lt;BR /&gt;142 139&lt;BR /&gt;140 140&lt;BR /&gt;143 141&lt;BR /&gt;138 138&lt;BR /&gt;137 140&lt;BR /&gt;142 142&lt;BR /&gt;136 138&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used proc sql to find the difference between Y1 and Y2 and removed the rows where the difference is = 0 by using the code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc SQL;&lt;BR /&gt;/*create table temp as*/&lt;BR /&gt;select *,&lt;BR /&gt;Y1 - Y2 as Difference,&lt;BR /&gt;from NATR332&lt;BR /&gt;where (Y1-Y2 ^= 0)&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I now want to create a new column called rank where I rank the absolute value of the differences. I tried to use the rank () over partition in proc sql and didn't have any luck so I was thinking I would maybe have to use the proc rank function. How would I go about creating this column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 01:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478256#M123326</guid>
      <dc:creator>alilacey0</dc:creator>
      <dc:date>2018-07-16T01:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: proc rank</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478261#M123331</link>
      <description>&lt;P&gt;but you seem to know the answer ie use proc rank on the abs value of the difference ie abs(difference). And use "out=" on the proc rank statement to get the dataset. Incidentally, I wouldn't see any reason to exclude the 0's.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 03:14:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478261#M123331</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2018-07-16T03:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: proc rank</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478267#M123334</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I tried to use the rank () over partition in proc sql&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;PROC SQL doesn't support partition. PROC RANK will work, and the&amp;nbsp;&lt;/SPAN&gt;documentation has examples which is always the place to start.&lt;/P&gt;
&lt;P&gt;A fully worked example is here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=proc&amp;amp;docsetTarget=p12aek9f6xhl1zn1puuuot19wqi7.htm&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=proc&amp;amp;docsetTarget=p12aek9f6xhl1zn1puuuot19wqi7.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 03:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478267#M123334</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-16T03:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc rank</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478283#M123339</link>
      <description>&lt;P&gt;It's a good habit to always think about numerical precision (and missing values).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;where abs(Y1-Y2) &amp;gt; 1e-9&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;is better than&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;where (Y1-Y2 ^= 0)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 05:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478283#M123339</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-16T05:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: proc rank</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478284#M123340</link>
      <description>&lt;P&gt;[ Erroneous post removed by jet-lagged author &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ]&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 05:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-rank/m-p/478284#M123340</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-16T05:54:32Z</dc:date>
    </item>
  </channel>
</rss>

