<?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: SAS Quintile Groups in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643532#M21923</link>
    <description>&lt;P&gt;This happens because there are ties in the data. Or, it happens because you computed the quintiles improperly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know if it biases the results, I guess that depends on a lot of things.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Apr 2020 11:22:59 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-04-28T11:22:59Z</dc:date>
    <item>
      <title>SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643523#M21922</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a question about quintile group proportions please. I have developed a score and categorised it into quintiles. However, the categories are not exactly equal to 20%. There is a difference of at least 2000 frequencies between some quintiles. I am unable to understand why this would happen and would this bias the results?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643523#M21922</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2020-04-28T11:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643532#M21923</link>
      <description>&lt;P&gt;This happens because there are ties in the data. Or, it happens because you computed the quintiles improperly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know if it biases the results, I guess that depends on a lot of things.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:22:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643532#M21923</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-28T11:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643569#M21924</link>
      <description>&lt;P&gt;Thank you so much for the response! I will look into both these possibilities..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 12:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643569#M21924</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2020-04-28T12:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643614#M21925</link>
      <description>&lt;P&gt;Show HOW you calculated the quintiles.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are also different rules of what to do with ties in the data depending on how the data is to be used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also consider how many records/ values you actually have. If I only have 3 values and create quintiles getting exactly 20% into each is going to be a tad difficult.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 14:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643614#M21925</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-28T14:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643700#M21927</link>
      <description>&lt;P&gt;Dear ballardw thank you very much for the response...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance I do the following&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new1; set new1;&lt;/P&gt;&lt;P&gt;Food_score = sum (rank_alcohol,&amp;nbsp;rank_calcium, rank_eggs, rank_fish);&lt;/P&gt;&lt;P&gt;&amp;nbsp;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc univariate data=new1;&lt;/P&gt;&lt;P&gt;var Food_score;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc rank data=new1 out=new1 groups=5 ;&lt;/P&gt;&lt;P&gt;var Food_score;&lt;/P&gt;&lt;P&gt;ranks rank_Food_score;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=new1;&amp;nbsp; table rank_Food_score;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are around 70k observations. I still get a 2000-3000 difference&amp;nbsp; between first and second and second and third quintile...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any thoughts!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 19:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643700#M21927</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2020-04-28T19:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643706#M21928</link>
      <description>&lt;P&gt;I wasnt sure if this was of any help in this regard..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quantiles (Définition 5)&lt;/P&gt;&lt;P&gt;100Max&lt;/P&gt;&lt;P&gt;100% 57&lt;/P&gt;&lt;P&gt;99% 50&lt;/P&gt;&lt;P&gt;95% 47&lt;/P&gt;&lt;P&gt;90% 45&lt;/P&gt;&lt;P&gt;75%&lt;/P&gt;&lt;P&gt;Q3 42&lt;/P&gt;&lt;P&gt;50%&lt;/P&gt;&lt;P&gt;Médiane 39&lt;/P&gt;&lt;P&gt;25% Q1 36&lt;/P&gt;&lt;P&gt;10% 33&lt;/P&gt;&lt;P&gt;5% 31&lt;/P&gt;&lt;P&gt;1% 28&lt;/P&gt;&lt;P&gt;0% Min 19&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Observations extrêmes&lt;/P&gt;&lt;P&gt;La plus petite La plus grande&lt;/P&gt;&lt;P&gt;Valeur Obs Valeur Obs&lt;/P&gt;&lt;P&gt;19&amp;nbsp; 31452&amp;nbsp; &amp;nbsp;56 33859&lt;/P&gt;&lt;P&gt;19&amp;nbsp; 7884&amp;nbsp; &amp;nbsp; &amp;nbsp;56 34418&lt;/P&gt;&lt;P&gt;20&amp;nbsp; 41480&amp;nbsp; &amp;nbsp;56 63090&lt;/P&gt;&lt;P&gt;20&amp;nbsp; 11027&amp;nbsp; &amp;nbsp;57 8425&lt;/P&gt;&lt;P&gt;21&amp;nbsp; 41794&amp;nbsp; &amp;nbsp;57 63350&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 19:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643706#M21928</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2020-04-28T19:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643708#M21929</link>
      <description>&lt;P&gt;Did you check for ties?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 19:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643708#M21929</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-28T19:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643710#M21930</link>
      <description>&lt;P&gt;I did not check for ties but I will do that now.. I haven't done that before so I will review the codes&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate the response!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 19:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643710#M21930</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2020-04-28T19:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643714#M21931</link>
      <description>&lt;P&gt;From the documentation of proc ranks under the Groups option for the proc statement:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="xis-refProc"&gt;
&lt;DIV class="xis-procStatement"&gt;
&lt;DIV class="xis-procStatementSyntax"&gt;
&lt;DIV class="xis-syntaxDescription"&gt;
&lt;DIV class="xis-optionalArgGroup"&gt;
&lt;DIV id="n0ap7rle6oq6fon1209x0i7085jq" class="xis-argDescriptionPair"&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimple"&gt;If the number of observations is evenly divisible by the number of groups, each group has the same number of observations, provided there are no tied values at the boundaries of the groups. Grouping observations by a variable that has many tied values can result in unbalanced groups because PROC RANK always assigns observations with the same value to the same group.&lt;/P&gt;
&lt;P class="xis-paraSimple"&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;An implication of that is if you have a smallish number of values, say scores of from 1 to 10, then you are likely to have many ties at the boundaries and so the rank set for the boundary value gets repeated. A lot.&lt;/P&gt;
&lt;P&gt;Here is a concrete example that demonstrates the behavior. The range of X values and the group size picked is such that every value of X is a "boundary".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data junk;
 do i= 1 to 1000;
   x = rand('integer',5);
   output;
 end;
run;

proc rank data=junk out=junk2 groups=5;
   var x ;
   ranks rank_x;
run;

proc freq data=junk2; 
   table x*rank_x /list;
run;&lt;/PRE&gt;
&lt;P&gt;The proc freq demonstrates that all of the X values get the same rank.&lt;/P&gt;
&lt;P&gt;If you need to force such an equal number of rank values then, using the above data, here is one way.&lt;/P&gt;
&lt;PRE&gt;proc sort data=junk;
   by x;
run;

data want;
   set junk nobs=obscount;
   retain rank 0;
   if mod(_n_-1, floor(obscount/5))= 0 then rank+1;
run;

proc freq data=want;
   tables x*rank rank/list;
run;&lt;/PRE&gt;
&lt;P&gt;The sort is needed to get the raw values in place. The option NOBS on the SET statement sets a temporary variable with the value of the number of records in the data set. Warning: if you have missing values for the variable you need to "rank" then this doesn't work as the obscount won't match what you need.&lt;/P&gt;
&lt;P&gt;The MOD&amp;nbsp; and Floor functions are documented in the help.&lt;/P&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;</description>
      <pubDate>Tue, 28 Apr 2020 20:10:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643714#M21931</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-28T20:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643718#M21932</link>
      <description>&lt;P&gt;Thank you so much for this!&lt;/P&gt;&lt;P&gt;I ran the codes and got something like this..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;rank Fréquence Pourcentage Fréquence cumulée Pourcentage cumulé&lt;/P&gt;&lt;P&gt;1 14198 20.00 14198 20.00&lt;/P&gt;&lt;P&gt;2 14198 20.00 28396 40.00&lt;/P&gt;&lt;P&gt;3 14198 20.00 42594 60.00&lt;/P&gt;&lt;P&gt;4 14198 20.00 56792 80.00&lt;/P&gt;&lt;P&gt;5 14198 20.00 70990 100.00&lt;/P&gt;&lt;P&gt;6 1 0.00 70991 100.00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it is basically giving 6 groups now and the other 5 are equal. I wondered how to get 5 groups?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 20:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643718#M21932</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2020-04-28T20:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643733#M21933</link>
      <description>&lt;P&gt;You could simply break the ties by adding a bit of noise:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data new1; set new1;
Food_score = sum (rank_alcohol, rank_calcium, rank_eggs, rank_fish);
 run;

proc univariate data=new1;
var Food_score;
run;

data new2;
set new1;
food_score_rnd = food_score + 0.001 * rand("uniform");
run;

proc rank data=new2 out=new3 groups=5 ;
var Food_score_rnd;
ranks rank_Food_score;
run;

proc freq data=new3;  table rank_Food_score;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Apr 2020 22:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643733#M21933</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-04-28T22:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643735#M21934</link>
      <description>&lt;P&gt;Since I don't have your data it is hard to say exactly but if your number of observations is not exactly equal to a multiple of 5(or what ever divisor is used) your last group could be short or an additional "group" is created. Note that you have exactly one in the last group. Since you&amp;nbsp; have 70991 records you can never get them to be exactly one-fifth in each group. 5 goes into 70991 how many times (14198) and with what remainder (1)?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 22:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643735#M21934</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-28T22:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643995#M21943</link>
      <description>&lt;P&gt;See an explanation and example of using PROC RANK to group data (and why the groups might not be equal), see&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2012/09/24/grouping-observations-based-on-quantiles.html" target="_self"&gt;"Grouping observations based on quantiles"&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;&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;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 15:19:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/643995#M21943</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-04-29T15:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/644021#M21944</link>
      <description>&lt;P&gt;Thank you so much for the detailed explanation, it was very helpful&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 16:34:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/644021#M21944</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2020-04-29T16:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Quintile Groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/644022#M21945</link>
      <description>&lt;P&gt;Yes this seemed to work! I appreciate the help!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 16:36:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Quintile-Groups/m-p/644022#M21945</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2020-04-29T16:36:02Z</dc:date>
    </item>
  </channel>
</rss>

