Date: Wed, 27 Jul 2011 10:23:59 -0700
Reply-To: Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Subject: Re: Top 5 and All Other
Content-Type: text/plain; charset=us-ascii
for a possible SQL solution. It's probably not cheap, and it might not handle ties the way you want (I don't remember).
If you're interested in interesting SQL solutions, pick up Joe Celko's book, "SQL for Smarties". In these days of on-line book sales, giving an ISBN would be somewhere between useless and worse-than-useless.
On Jul 27, 2011, at 5:23 AM, Adams, Nicholas 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.