LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 1997, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 13 Feb 1997 21:07:31 +0100
Reply-To:     ehoogenb@solair1.inter.nl.net
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Eric Hoogenboom <ehoogenb@SOLAIR1.INTER.NL.NET>
Organization: NLnet
Subject:      Re: - SQL group by - problem
Content-Type: text/plain; charset=us-ascii

mik wrote: > > I'm having a problem with SAS-sql. I would like my proc SQL to do the > same as my proc summary >

> proc summary data=name; > by group; > var amount; > id name; > output out=name2 sum(amount)=total; > run; > > Result (name2) : > > Group Name Total > 1 Sue 30 > 2 Sue 70 > (...)

I wouldn't know why you should exclude John from your output, but when you want only one name with the group, why not use the MAX or MIN function:

select group, max(name) as name, sum(amount) as total from name group by group;

When you group by group you do not have to order by group as far as I am concerned.

Hope this helps,

Eric.


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