BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
PeteSAS
Fluorite | Level 6

Is there a way to use functions within an IN clause (or am I totally wrecking the syntax)? Example:

 

proc sql;
create table myExample as
select datepart(myDate) as fmtDate format mmddyy8., sum(myStuff) as sum_stuff
from myTable
where datepart(myDate) in (mdy(11,15,2024), mdy(12,1,2024), mdy(1,1,2025))
group by myDate
;

myDate is a SQL Server DateTime field, hence the datepart addition there. SAS EG seems to want me to put a nested select in that "IN" clause, so it's choking on the MDY functions. Obviously there are a myriad other ways to do this, just wondering if it's a limitation of SAS that functions can't be used within IN clauses.

 

Thanks in advance!