<?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 code to find upper and lower bound scores that would create 10 equal deciles of records in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542867#M150050</link>
    <description>Thanks a lot for your help!!</description>
    <pubDate>Wed, 13 Mar 2019 16:30:18 GMT</pubDate>
    <dc:creator>jeremy4</dc:creator>
    <dc:date>2019-03-13T16:30:18Z</dc:date>
    <item>
      <title>SAS code to find upper and lower bound scores that would create 10 equal deciles of records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542724#M149973</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset and for a variable (e.g. application_scores), is there a way of finding out the lower and upper bound numbers that would split the total number of records in the dataset into 10 equal deciles? The example below was the upper and lower bound numbers that were previously obtained but can someone please provide some code to obtain the correct scores (i.e. instead of 370 and 474, what would it be now?) that would split the records into 10 bands in my updated dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;else if 370&amp;lt;=application_scores&amp;lt;=474 then band='10';&lt;BR /&gt;else if 475&amp;lt;=application_scores&amp;lt;=539 then band='09';&lt;BR /&gt;else if 540&amp;lt;=application_scores&amp;lt;=616 then band='08';&lt;BR /&gt;else if 617&amp;lt;=application_scores&amp;lt;=686 then band='07';&lt;BR /&gt;else if 687&amp;lt;=application_scores&amp;lt;=815 then band='06';&lt;BR /&gt;else if 816&amp;lt;=application_scores&amp;lt;=929 then band='05';&lt;BR /&gt;else if 930&amp;lt;=application_scores&amp;lt;=975 then band='04';&lt;/P&gt;&lt;P&gt;else if 976&amp;lt;=application_scores&amp;lt;=1011 then band='03';&lt;BR /&gt;else if 1012&amp;lt;=application_scores&amp;lt;=1120 then band='02';&lt;BR /&gt;else if 1121&amp;lt;=application_scores then band='01';&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 11:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542724#M149973</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-03-13T11:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to find upper and lower bound scores that would create 10 equal deciles of records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542728#M149974</link>
      <description>&lt;P&gt;Maybe proc rank is useful to build a solution, but without seeing data and the expected result, it is difficult to suggest something.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 11:38:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542728#M149974</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-03-13T11:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to find upper and lower bound scores that would create 10 equal deciles of records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542732#M149977</link>
      <description>&lt;P&gt;You can do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   do x=1 to 1e4;
      y=rand('integer', 1, 100);
      output;
   end;
run;

proc rank data=have groups=10 descending out=want;
   var y;
   ranks decile;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 11:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542732#M149977</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-13T11:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to find upper and lower bound scores that would create 10 equal deciles of records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542736#M149981</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc rank data=have groups=10 ties=high out=want;
   var y;
   ranks decile;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 12:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542736#M149981</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-03-13T12:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to find upper and lower bound scores that would create 10 equal deciles of records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542806#M150009</link>
      <description>&lt;P&gt;Thanks for your reply, your code works and I can see which band each record would fit into.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, is there code available to look at all of the records for that one variable, application_score, and tell me what the lower and upper bound limits were to put an equal amount of records to make 10 bands (ie. in the Results tab, there would be 10 numbers of lower limits (one for each band), and 10 numbers of upper limits (one for each band)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;There are 100 records, so there should be 10 records in each band and it would pick out the lower and upper bound scores for each band so that this would be satisfied.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;U&gt;code would identify the numbers e.g. 0 and 9 for band 1, 10 and 19 for band 2&lt;/U&gt; etc..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Band 1:&amp;nbsp; &amp;nbsp; 0&amp;lt;=application_score&amp;lt;=9&lt;/P&gt;&lt;P&gt;Band 2:&amp;nbsp; &amp;nbsp;10&amp;lt;=application_score&amp;lt;=19&lt;/P&gt;&lt;P&gt;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; :&lt;/P&gt;&lt;P&gt;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; :&lt;/P&gt;&lt;P&gt;Band 10: 90&amp;lt;=application_score&amp;lt;=99&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 14:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542806#M150009</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-03-13T14:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to find upper and lower bound scores that would create 10 equal deciles of records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542820#M150015</link>
      <description>&lt;P&gt;Thanks for your code. However, is there a way of identifying the lower and upper limits for each of the band in the Results/Output data tab, similar to an example I have created below? If there were 100 records in total in my dataset, the code would split it into 10 groups of 10 records and identify the band's lower and upper bounds for each band (e.g. 500 as the lower bound and 575 as the upper bound for band 1).&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="SAS deciles.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27901iA8B9E3666D2F4A10/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS deciles.PNG" alt="SAS deciles.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 15:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542820#M150015</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-03-13T15:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to find upper and lower bound scores that would create 10 equal deciles of records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542857#M150044</link>
      <description>&lt;P&gt;I think this is what you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   do x=1 to 1e4;
      y=rand('integer', 1, 100);
      output;
   end;
run;

proc rank data=have groups=10 descending out=temp;
   var y;
   ranks band;
run;

proc sql;
   create table want as
   select band,
          min(y) as lower,
          max(y) as upper,
          count(y) as numrecords
   from temp
   group by band;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 16:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542857#M150044</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-13T16:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to find upper and lower bound scores that would create 10 equal deciles of records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542867#M150050</link>
      <description>Thanks a lot for your help!!</description>
      <pubDate>Wed, 13 Mar 2019 16:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542867#M150050</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-03-13T16:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to find upper and lower bound scores that would create 10 equal deciles of records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542882#M150055</link>
      <description>&lt;P&gt;Anytime, glad to help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 16:48:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542882#M150055</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-13T16:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to find upper and lower bound scores that would create 10 equal deciles of records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542896#M150057</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a reason why the band lower and upper limits have an equal width for all of the bands?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS deciles output.PNG" style="width: 405px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27906iCEF1A16339EADEE5/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS deciles output.PNG" alt="SAS deciles output.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I change the line of code that you provided: DSC_OPTIN_91BWN=rand('integer', 1, 100);, i.e. change the 1 to -447 and the 100 to 1246, the numrecords changes to 10% in each band out of the 93,260 records in my dataset, t&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the problem is that when I change the minimum to -999, it creates band 9 (-999 to -779) and has 9349 records. I have checked the minimum value of the variable and it is only -447, sow can the table say that there would be 9349 records in band 9 and even 9288 in band 8, despite the two bands being beyond the minimum?&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS -999.PNG" style="width: 404px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27907i70F0607DCC984760/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS -999.PNG" alt="SAS -999.PNG" /&gt;&lt;/span&gt;&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>Wed, 13 Mar 2019 17:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-find-upper-and-lower-bound-scores-that-would-create/m-p/542896#M150057</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-03-13T17:26:37Z</dc:date>
    </item>
  </channel>
</rss>

