If the condition is simple such as a specific value the easiest may be a WHERE clause dataset option
data merged;
merge a (where=(age > 25))
b (where=(LastName ne 'Smith'))
;
by id;
run;
If multiple conditions using functions are needed you'll likely need to subset the data separately.
2025 SAS Hackathon: There is still time!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!