DATA Step, Macro, Functions and more

Merge with Where condition?

Accepted Solution Solved
Reply
Regular Contributor
Posts: 212
Accepted Solution

Merge with Where condition?

Hi. Can I use a dataset Where condition during a Merge?  And if so, how can I change 'is not null' to reflect SAS missing values?

 

Any help would be greatly appreciated.

 

data QueryData;
  merge bids_ora.bi_spm_piece_recon (in=a)
        iv_ora.bi_spm_piece_recon (in=b) (where excl_sts_code is not null);
  by imb_code spm_calc_batch_date;
  if a and b;
run;

Accepted Solutions
Solution
‎05-09-2016 12:15 PM
Super User
Posts: 5,260

Re: Merge with Where condition?

I guess you could, but I've never tried it with merge.

No need to to change NULL keyword, SAS treats that as MISSING if you are using SAS data.

But you are not using the correct ds option syntax, you need to write (where=(filter condition)).

Data never sleeps

View solution in original post


All Replies
Solution
‎05-09-2016 12:15 PM
Super User
Posts: 5,260

Re: Merge with Where condition?

I guess you could, but I've never tried it with merge.

No need to to change NULL keyword, SAS treats that as MISSING if you are using SAS data.

But you are not using the correct ds option syntax, you need to write (where=(filter condition)).

Data never sleeps
Regular Contributor
Posts: 212

Re: Merge with Where condition?

Thanks very much.
Trusted Advisor
Posts: 1,115

Re: Merge with Where condition?

Hi @buechler66,

 

This is no problem. Just use the correct syntax as mentioned by @LinusH:

iv_ora.bi_spm_piece_recon (in=b where=(excl_sts_code is not null));
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 289 views
  • 1 like
  • 3 in conversation