How to exclude certain observations in a merge step?

Reply
Frequent Contributor
Posts: 131

How to exclude certain observations in a merge step?

Hi:

In a merge step, I'd like to exclude certain observations from being matched or merged. How would I code this?

Thanks!!

Grand Advisor
Posts: 10,251

Re: How to exclude certain observations in a merge step?

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.

Ask a Question
Discussion stats
  • 1 reply
  • 129 views
  • 0 likes
  • 2 in conversation