The two queries below work; however, is there a way to combine the two queries?
proc sql;
select term, count(id)as Applicants ,avg(GPA)as AvgGPA
from
SAMPLE
where level="H"
group by term;
quit;
proc sql;
select term,
count(id)as Admits, /*this gives you the Admit count*/
avg(gpa) as AvgAdmitGPA /*this gives you the average Admit gpa*/
from
SAMPLE
where level="H" and (code like "A%" or
code like "X%")
group by term;
quit;
Below is my attempt to combine the two queries; however, it does not work. Any Suggestions? What am I doing wrong?
proc sql;
select term, a.Applicants, a.AvgGPA, b.admits, b.AvgAdmitGPA
from
(select count(id)as Applicants ,avg(GPA)as AvgGPA
from
SAMPLE
Where level="H"
group by term
order by applicants, avgGPA)as a,
(select term,
count(id)as Admits,
avg(gpa) as AvgAdmitGPA
from
SAMPLE
where level="H" and (code like "A%" or
code like "X%")
group by term
order by admits, AvgAdmitGPA)as b
group by term;
quit;
proc sql;
select term, count(id)as Applicants ,avg(GPA)as AvgGPA
from
SAMPLE
where level="H"
group by term;
quit;
proc sql;
select term,
count(id)as Admits, /*this gives you the Admit count*/
avg(gpa) as AvgAdmitGPA /*this gives you the average Admit gpa*/
from
SAMPLE
where level="H" and (code like "A%" or
code like "X%")
group by term;
quit;
Below is my attempt to combine the two queries; however, it does not work. Any Suggestions? What am I doing wrong?
proc sql;
select term, a.Applicants, a.AvgGPA, b.admits, b.AvgAdmitGPA
from
(select count(id)as Applicants ,avg(GPA)as AvgGPA
from
SAMPLE
Where level="H"
group by term
order by applicants, avgGPA)as a,
(select term,
count(id)as Admits,
avg(gpa) as AvgAdmitGPA
from
SAMPLE
where level="H" and (code like "A%" or
code like "X%")
group by term
order by admits, AvgAdmitGPA)as b
group by term;
quit;