LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (July 2011, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: "Adams, Nicholas" <NRAdams@CVTY.COM>
In-Reply-To:  <AD4D009B201C104A87056D05DAEA2C1DD1EB2D@AZPH-SRV-MAIL09.cvty.com>
Content-Type: text/plain; charset=us-ascii

See

http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0103C&L=sas-l&P=R1905&D=0

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; > quit; > > > Want: > > Vendor1 1000 > Vendor2 800 > Vendor3 700 > Vendor4 400 > Vendor5 200 > All Other 2000 > > > > > > Nick > > > 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.


Back to: Top of message | Previous page | Main SAS-L page