<?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 How to get a summary for the top 5%, 10% and other data in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37027#M9382</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a sample with one dependent dummary variable y (0, 1). The data has been sorted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the question is how I can get easily get a summary (e.g. mean, freq) for the top 5%, 10%, 15%, 20%, 25%, ... 95% sample. I hope there is a way to do this easily, rather than use separate steps to produce the results. Any procedure to do this, PROC UNIVARIATE, PROC FREQ, PROC MEANS?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Jul 2011 16:55:42 GMT</pubDate>
    <dc:creator>bncoxuk</dc:creator>
    <dc:date>2011-07-26T16:55:42Z</dc:date>
    <item>
      <title>How to get a summary for the top 5%, 10% and other data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37027#M9382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a sample with one dependent dummary variable y (0, 1). The data has been sorted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the question is how I can get easily get a summary (e.g. mean, freq) for the top 5%, 10%, 15%, 20%, 25%, ... 95% sample. I hope there is a way to do this easily, rather than use separate steps to produce the results. Any procedure to do this, PROC UNIVARIATE, PROC FREQ, PROC MEANS?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 16:55:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37027#M9382</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-07-26T16:55:42Z</dc:date>
    </item>
    <item>
      <title>How to get a summary for the top 5%, 10% and other data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37028#M9383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to tell us more.&amp;nbsp; If you really do only have one dv, and it IS binary, I would think that just proc freq would provide everything that you need.&amp;nbsp; If it is more complex, proc rank might be what you are looking for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 17:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37028#M9383</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-26T17:00:22Z</dc:date>
    </item>
    <item>
      <title>How to get a summary for the top 5%, 10% and other data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37029#M9384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the variable only has 2 levels it cannot be divided into 20 groups.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a continuous variable then PROC RANK will divide the data into 20 groups and you can summarize using the GROUP as a class variable..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;rank&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=sashelp.heart &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=g &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;groups&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;20&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; weight;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;ranks&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; g;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;means&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;g&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;class&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; g;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;var&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;weight&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 17:27:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37029#M9384</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-07-26T17:27:59Z</dc:date>
    </item>
    <item>
      <title>How to get a summary for the top 5%, 10% and other data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37030#M9385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry that I did not explain clearly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want is to get the descriptive statistics for the top 5% data, top10% data, top 15%... Here, the data have been sorted in a proper order. The descriptive statistics are just for a single variable (which is a dummy type y=0 or 1).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 17:42:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37030#M9385</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-07-26T17:42:48Z</dc:date>
    </item>
    <item>
      <title>How to get a summary for the top 5%, 10% and other data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37031#M9386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Just create a grouping variable based on obs number and total obs that makes 20 groups.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 17:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37031#M9386</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-07-26T17:48:39Z</dc:date>
    </item>
    <item>
      <title>How to get a summary for the top 5%, 10% and other data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37032#M9387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;and you may want to look into insight.&amp;nbsp; If you license it, you can activate it by either runing the word insight from the command line, or running the command DM "insight";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have found it to be an invaluable way to see both the statistics, and graphical representations, of one's data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 19:06:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37032#M9387</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-26T19:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a summary for the top 5%, 10% and other data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37033#M9388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks art297. I learned &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2011 19:21:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37033#M9388</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-07-26T19:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a summary for the top 5%, 10% and other data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37034#M9389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data test;
 do index=1 to 100;
&amp;nbsp; y=int(ranuni(-1)*2);
&amp;nbsp; output;
 end;
run;
proc sort data=test ;
 by descending index;
run;

%let dsid=%sysfunc(open(test));
%let nobs=%sysfunc(attrn(&amp;amp;dsid,nobs));
%let dsid=%sysfunc(close(&amp;amp;dsid));

%let want_percent=.2;
%let want_top=%sysevalf(&amp;amp;nobs*&amp;amp;want_percent,integer);
%put _user_;

proc means data=test(obs=&amp;amp;want_top) nway noprint;
 var y;
 output out=want mean= sum=/autoname;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2011 03:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-a-summary-for-the-top-5-10-and-other-data/m-p/37034#M9389</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-08-03T03:59:42Z</dc:date>
    </item>
  </channel>
</rss>

