<?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: Sorting by ascending value and and rank  (if same value then  given the average of the ranking) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sorting-by-ascending-value-and-and-rank-if-same-value-then-given/m-p/796479#M255589</link>
    <description>&lt;P&gt;Proc Rank to the rescue:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input subjid  value;
format subjid z3.;
cards;
001     -4
005     -4
003     30
002     -4
004     -4
006     26
007     6
;
run;

proc rank data = have out = want DESCENDING;
  var value;
  ranks rank;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;B&lt;/P&gt;</description>
    <pubDate>Wed, 16 Feb 2022 08:28:46 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2022-02-16T08:28:46Z</dc:date>
    <item>
      <title>Sorting by ascending value and and rank  (if same value then  given the average of the ranking)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-by-ascending-value-and-and-rank-if-same-value-then-given/m-p/796477#M255587</link>
      <description>&lt;P&gt;I have dataset like this&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input subjid  value;
format subjid z3.;
cards;
001     -4
005     -4
003     30
002     -4
004     -4
006     26
007     6
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;step1: Sorting by ascending and give rank number.&lt;/P&gt;&lt;P&gt;step2:subject with the same vaule are given the average of the rankings;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For step 2 : I have no idea how to output&amp;nbsp;average of the rankings;&lt;/P&gt;&lt;P&gt;Please kindly help;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Final output result i want&amp;nbsp; like this ,&lt;/P&gt;&lt;P&gt;I hope that helps you understand my question&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data want;
input subjid  value rank;
format subjid z3.;
cards;
001     -4    5.5
005     -4    5.5
003     30    1
002     -4    5.5
004     -4    5.5
006     26    2
007     6     3
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 08:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-by-ascending-value-and-and-rank-if-same-value-then-given/m-p/796477#M255587</guid>
      <dc:creator>Garyho</dc:creator>
      <dc:date>2022-02-16T08:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by ascending value and and rank  (if same value then  given the average of the ranking)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-by-ascending-value-and-and-rank-if-same-value-then-given/m-p/796479#M255589</link>
      <description>&lt;P&gt;Proc Rank to the rescue:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input subjid  value;
format subjid z3.;
cards;
001     -4
005     -4
003     30
002     -4
004     -4
006     26
007     6
;
run;

proc rank data = have out = want DESCENDING;
  var value;
  ranks rank;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;B&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 08:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-by-ascending-value-and-and-rank-if-same-value-then-given/m-p/796479#M255589</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2022-02-16T08:28:46Z</dc:date>
    </item>
  </channel>
</rss>

