Case Code and Average

Dona

Registered User.
Local time
Today, 11:56
Joined
Jun 27, 2002
Messages
55
Please help.
The sum statements work; however, when I add the GPA statements, this does not work.
Any suggestions. I will need averages for other fields. What am I doing wrong??:confused:


SELECT Term, Sum(CASE when apc Not Like "YN" then 1 else 0 end) AS Applicants,
avg(CASE when GPA = apc Not Like "YN" then gpac end)as AvgApplicantGPA,
Sum(CASE when apc like "A%" or apc like "S%"
then 1 else 0 end)AS Admits, Avg(CASE when apc like "A%" or apc
or apc like "S%" then GPAC)AS AvgGPA Admits
FROM TEMP
GROUP BY Term;
quit;


This is a sample of the results I want.

Term APPS App Admit
GPA Admits GPA
1990 29 3.69 19 3.89
2000 31 3.59 17 3.82
2001 36 3.83 23 4.03


Thank you.!
 
This makes no sense:

CASE when GPA = apc Not Like "YN"

Something is either = to something else, or Like it, but not both.
 

Users who are viewing this thread

Back
Top Bottom