|Date: ||Wed, 27 Jul 2011 10:05:16 -0500|
|Reply-To: ||"Data _null_;" <iebupdte@GMAIL.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||"Data _null_;" <iebupdte@GMAIL.COM>|
|Subject: ||Re: Top 5 and All Other|
|Content-Type: ||text/plain; charset=ISO-8859-1|
I like to summarize using SAS procedures. If you want the top 5
frequencies you should consider ties.
proc summary data=sashelp.class nway;
class name / order=freq;
proc rank descending;
if first.grp and N le 5 then n + 1;
if n gt 5 then name='Other';
proc freq order=data;
On Wed, Jul 27, 2011 at 7:23 AM, Adams, Nicholas <NRAdams@cvty.com> wrote:
> Is there an easy way through proc sql or data step that I can summarize
> the top 5 vendors and then group 6+ into an all other. I know I can do
> an Outobs=5, but then I lose the all other. Is there a Case Statement,
> or some other trick I can use?
> proc sql;
> create table Summary as
> select Vendor, sum(allowed)
> from test.met
> group by Vendor
> order by allowed desc;
> Vendor1 1000
> Vendor2 800
> Vendor3 700
> Vendor4 400
> Vendor5 200
> All Other 2000
> Email Confidentiality Notice: The information contained in this transmission is confidential, proprietary or privileged and may be subject to protection under the law, including the Health Insurance Portability and Accountability Act (HIPAA).
> The message is intended for the sole use of the individual or entity to whom it is addressed. If you are not the intended recipient, you are notified that any use, distribution or copying of the message is strictly prohibited and may subject you to criminal or civil penalties. If you received this transmission in error, please contact the sender immediately by replying to this email and delete the material from any computer.