Date: Fri, 14 Feb 1997 14:03:24 +0000
Reply-To: herbertj@bre.co.uk
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: John Herbert <herbertj@BRE.CO.UK>
Subject: Re: - SQL group by - problem
To be fair, Mikal - the SQL is doing exactly what you asked it to. The proc
summary code is actually cheating somewhat when it gives you the name as 'Sue'
- because it (wrongly) implies that Sue contributed to the full total shown.
That aside, you can use max(name) in the SQL select statement (instead of
'name') to fiddle an identical result.
John.
Mikal Netteberg, Denmark wrote:
>When I use the proc SQL :
>proc sql;
> select group, name, sum(amount) as total
> from name
> group by group
> order by group;
>quit;
>proc sql;
> select group, name, sum(amount) as total
> from name
> group by group
> order by group;
>quit;
>I get this :
>Group Name Total
>1 John 30
>1 Sue 30
>2 John 70
>2 Sue 70
Date: 14-Feb-1997 02:03pm
From: John Herbert
HERBERTJ
Tel No: 01923 664732
Subject: Re: - SQL group by - problem
|