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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Registration is open
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss. Register now and lock in 2025 pricing—just $495!