Help using Base SAS procedures

PROC SQL: Functions after WHERE not allowed.

Reply
N/A
Posts: 0

PROC SQL: Functions after WHERE not allowed.

This code is incorrect:

proc sql;
create table new as
select * from old
where id in (select distinct id from old
where min(x) ge 5 and min(x) le 10);
quit;

I want ALL records for EACH individual(id) whose minimum value for x is in the interval [5,10].

How can I get those records?
Contributor
Posts: 74

Re: PROC SQL: Functions after WHERE not allowed.

Posted in reply to deleted_user
proc sql;
create table new as
select * from old
where calculated min(x) ge 5 and calculated min(x) le 10
group by id;
quit;
PROC Star
Posts: 1,760

Re: PROC SQL: Functions after WHERE not allowed.

Posted in reply to abdullala
The code above does not work. Please check before posting.

I want ALL records for EACH gender whose maximum value for age is in the interval [16,17]:

select *
from sashelp.class
group by sex
having 16 le max(age) le 17
;
Ask a Question
Discussion stats
  • 2 replies
  • 104 views
  • 0 likes
  • 3 in conversation