| Date: | Sat, 14 Mar 1998 16:32:27 -0500 |
| Reply-To: | Richard A DeVenezia <radevenz@IX.NETCOM.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | Richard A DeVenezia <radevenz@IX.NETCOM.COM> |
| Organization: | Netcom |
| Subject: | Question about SQL having statement. |
|---|
I have some data organized as follows:
data study;
input class level reading;
cards;
1 1 .1
1 1 .15
1 1 .2
1 2 .4
1 2 .5
1 2 .6
1 3 2
1 3 2.5
1 3 3
2 1 5
2 1 6
2 1 7
;
To obtain the mean reading of the smallest level within class 1 I am using
proc sql;
select mean(reading) from (select reading from study where class=1 having
level=min(level));
quit;
I am wondering if there is a way to get a mean reading of the smallest level
within a class without using the form:
select ... from (select ...);
My first attempt was
proc sql;
select mean(reading) from study where class=1 having level=min(level);
quit;
which returns three rows showing the mean of the entire class=1.
From this I would infer the having statement is strictly for selecting
observations for output and has no bearing on summary function grouping. Is
this a correct assesment ?
|