<?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 The %GAINLIFT macro (using PROC RANK) is not ranking data properly when there are many ties in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459840#M70276</link>
    <description>&lt;P&gt;I'm using 2 different procedures for binary classification: logistic regression (PROC LOGISTIC) and random forest (PROC HPFOREST).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, consider PROC LOGISTIC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic
	data = sashelp.junkmail
		noprint;
	model	class (event = '1') = Exclamation Dollar Pound CapAvg CapLong CapTotal;
	output	out = j1
		p = P_Class1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will now use the %GAINLIFT macro to produce the lift table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/41/683.html" target="_blank"&gt;http://support.sas.com/kb/41/683.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include 'Desktop\gainlift.sas';

%GainLift(data = j1, response = Class, p = P_Class1, event = '1', groups = 10, graphopts = NOGRAPH);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the resulting table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="logistic.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20355i7D5EFFFA8938FE3B/image-size/large?v=v2&amp;amp;px=999" role="button" title="logistic.png" alt="logistic.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice that the number of records in each decile group is roughly the same (n = 460 in most classes).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, let's consider PROC HPFOREST.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods exclude all;
proc hpforest
	data = sashelp.junkmail
		seed = 123;
	target 	Class / level = binary;
	input 	Exclamation Dollar Pound CapAvg CapLong CapTotal / level = interval;
	score 	out = j2;
run;
ods exclude none;

%GainLift(data = j2, response = Class, p = P_Class1, event = '1', groups = 10, graphopts = NOGRAPH);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the resulting table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rf.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20356iC5FC7810FDE2EA43/image-size/large?v=v2&amp;amp;px=999" role="button" title="rf.png" alt="rf.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice that the number of records in the first 2 deciles are very different from the rest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect that this occurs because there are ties in the predicted probabilities from a random forest.&amp;nbsp; The %GAINLIFT macro uses PROC RANK to rank the predicted probabilities, and I suspect that PROC RANK cannot deal with ties very well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My actual data set (which is confidential) shows much wider variation in the sample sizes in the decile groups than above.&amp;nbsp; This is a big problem, because I cannot use lift to assess the classifier when this occurs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I modify the %GAINLIFT macro so that the resulting lift table has roughly equal sample sizes between the decile groups?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 03 May 2018 20:43:29 GMT</pubDate>
    <dc:creator>PurpleNinja</dc:creator>
    <dc:date>2018-05-03T20:43:29Z</dc:date>
    <item>
      <title>The %GAINLIFT macro (using PROC RANK) is not ranking data properly when there are many ties</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459840#M70276</link>
      <description>&lt;P&gt;I'm using 2 different procedures for binary classification: logistic regression (PROC LOGISTIC) and random forest (PROC HPFOREST).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, consider PROC LOGISTIC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic
	data = sashelp.junkmail
		noprint;
	model	class (event = '1') = Exclamation Dollar Pound CapAvg CapLong CapTotal;
	output	out = j1
		p = P_Class1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will now use the %GAINLIFT macro to produce the lift table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/41/683.html" target="_blank"&gt;http://support.sas.com/kb/41/683.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include 'Desktop\gainlift.sas';

%GainLift(data = j1, response = Class, p = P_Class1, event = '1', groups = 10, graphopts = NOGRAPH);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the resulting table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="logistic.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20355i7D5EFFFA8938FE3B/image-size/large?v=v2&amp;amp;px=999" role="button" title="logistic.png" alt="logistic.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice that the number of records in each decile group is roughly the same (n = 460 in most classes).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, let's consider PROC HPFOREST.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods exclude all;
proc hpforest
	data = sashelp.junkmail
		seed = 123;
	target 	Class / level = binary;
	input 	Exclamation Dollar Pound CapAvg CapLong CapTotal / level = interval;
	score 	out = j2;
run;
ods exclude none;

%GainLift(data = j2, response = Class, p = P_Class1, event = '1', groups = 10, graphopts = NOGRAPH);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the resulting table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rf.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20356iC5FC7810FDE2EA43/image-size/large?v=v2&amp;amp;px=999" role="button" title="rf.png" alt="rf.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice that the number of records in the first 2 deciles are very different from the rest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect that this occurs because there are ties in the predicted probabilities from a random forest.&amp;nbsp; The %GAINLIFT macro uses PROC RANK to rank the predicted probabilities, and I suspect that PROC RANK cannot deal with ties very well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My actual data set (which is confidential) shows much wider variation in the sample sizes in the decile groups than above.&amp;nbsp; This is a big problem, because I cannot use lift to assess the classifier when this occurs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I modify the %GAINLIFT macro so that the resulting lift table has roughly equal sample sizes between the decile groups?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 20:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459840#M70276</guid>
      <dc:creator>PurpleNinja</dc:creator>
      <dc:date>2018-05-03T20:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: The %GAINLIFT macro (using PROC RANK) is not ranking data properly when there are many ties</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459852#M70277</link>
      <description>&lt;P&gt;Use the TIES option on the PROC RANK code to modify how it handles tied data. See the documentation for specifics.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p16s2o8e4bnqrin1phywxdaxqba7.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n128utp0vvfmlrn1lr0nbu0kf6nu" target="_blank"&gt;http://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p16s2o8e4bnqrin1phywxdaxqba7.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n128utp0vvfmlrn1lr0nbu0kf6nu&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 21:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459852#M70277</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-03T21:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: The %GAINLIFT macro (using PROC RANK) is not ranking data properly when there are many ties</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459868#M70280</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried TIES = HIGH, LOW, MEAN, and DENSE, and none of them produced equally large decile groups.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your suggestion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anybody else have any ideas?&amp;nbsp; I'm trying to use PROC UNIVARIATE to do the ranking, but I can't figure out how to incorporate it into the macro.&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 21:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459868#M70280</guid>
      <dc:creator>PurpleNinja</dc:creator>
      <dc:date>2018-05-03T21:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: The %GAINLIFT macro (using PROC RANK) is not ranking data properly when there are many ties</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459877#M70281</link>
      <description>&lt;P&gt;Are you sure you want to? If you have too many ties that would indicate a different issue, possible imbalance in your data. I'm not sure expecting exactly equal groups is something that makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the values are ties, how would you split them up?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider the series:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Trying to group the 5/6s with the 1/2s wouldn't make logical sense in this case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My nickel of thoughts.&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 22:27:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459877#M70281</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-03T22:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: The %GAINLIFT macro (using PROC RANK) is not ranking data properly when there are many ties</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459904#M70287</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may be right.&amp;nbsp; I may not want to break the ties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My ultimate goal is to split the predicted probabilities from the random forest into equally large decile groups.&amp;nbsp; Perhaps ties are not the problem, but I don't know what else is causing the imbalance in the sample sizes.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's ignore the ties for now.&amp;nbsp; Given this problem with the macro for my predicted probabilities from the random forest, how should I solve it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2018 00:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459904#M70287</guid>
      <dc:creator>PurpleNinja</dc:creator>
      <dc:date>2018-05-04T00:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: The %GAINLIFT macro (using PROC RANK) is not ranking data properly when there are many ties</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459918#M70288</link>
      <description>&lt;P&gt;Let's say that&amp;nbsp; for some reason, it's more important to generate same-size deciles that it is to preserve ties.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, then choose a very small epsilon to perturb p_class1 in tied groups prior to the GAINLIFT macro. &amp;nbsp; For each collection of tied values, add 0*epsilon to p_class1 for the 1st record,&amp;nbsp; add 1*epsilon to the second, 2*epsilon to the third, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the data are not absolutely pathological, you probably can find an epsilon small enough such that perturbing p_class1 for the last member of the largest tied group does not move p_class1 past the next distinct value.&amp;nbsp; And making such small changes in p_class1 should not change your substantive results if there is any real information in the data.&amp;nbsp; After all, the probabilities are estimates to begin with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might be able to set&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;epsilon=constant('small')&lt;/FONT&gt;&lt;/STRONG&gt; or some multiple of constant('small').&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2018 03:40:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/459918#M70288</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-05-04T03:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: The %GAINLIFT macro (using PROC RANK) is not ranking data properly when there are many ties</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/460026#M70292</link>
      <description>&lt;P&gt;I think you are encountering the situation where you have tied values and you are trying to use quantiles to subdivide the data. In this case, you will not get evenly divided groups. For a general discussion and example, see the article &lt;A href="https://blogs.sas.com/content/iml/2014/11/05/binning-quantiles-rounded-data.html" target="_self"&gt;"Binning data by quantiles? Beware of rounded data,"&lt;/A&gt; which also suggests possible workarounds.&lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2018 13:25:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/460026#M70292</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-05-04T13:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: The %GAINLIFT macro (using PROC RANK) is not ranking data properly when there are many ties</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/460069#M70295</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/106376"&gt;@PurpleNinja&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may be right.&amp;nbsp; I may not want to break the ties.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My ultimate goal is to split the predicted probabilities from the random forest into equally large decile groups.&amp;nbsp; Perhaps ties are not the problem, but I don't know what else is causing the imbalance in the sample sizes.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's ignore the ties for now.&amp;nbsp; Given this problem with the macro for my predicted probabilities from the random forest, how should I solve it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;DO NOT CALL THEM DECILES THEN. They also cannot be used to appropriately measure the differences because the groups are not actually different and any metrics will be uninterpretable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, if you want 10 equal groups, use a data step and END option to specify the number of groups.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This doesn't work well if you have small data but if you have a lot of data and bigger groups it's fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let n_groups=5;

data want;
set sashelp.class nobs=n_total;
retain group_size;
if _n_ = 1 then do;
group_size=floor(n_total/&amp;amp;n_groups);
group_index=1;
end;

if _n_ &amp;gt; group_size*group_index then 
     group_index+1;


 if group_index &amp;gt; &amp;amp;n_groups then group_index=&amp;amp;n_groups.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2018 15:01:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/The-GAINLIFT-macro-using-PROC-RANK-is-not-ranking-data-properly/m-p/460069#M70295</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-04T15:01:16Z</dc:date>
    </item>
  </channel>
</rss>

