SQUISH
SQUISH

Reputation: 165

Using function IN and OR in SAS data set

I have a data set WHERE condtion where I have rejection codes 75 or 76, how can I tell sas that in these 3 columns I want data where rejection code 1 , 2 and 3 have either code 75, code 76, or both?

**0 Grab pskw;
data pskw_data;
set PSKW.PSKWMaster;
where week in ('12-16-2016','12-23-2016','12-30-2016','01-06-2016') and CopayType ="FBD" and FNRX=1 and pme_id in (46,42,55,38) and COBPrimaryRejectCode1 in ( '75','76')  or COBPrimaryRejectCode2  in ('75','76') or COBPrimaryRejectCode3  or ('75','76');
run;

Upvotes: 1

Views: 34

Answers (1)

DomPazz
DomPazz

Reputation: 12465

I think you need some ( );

data pskw_data;
set PSKW.PSKWMaster;
where week in ('12-16-2016','12-23-2016','12-30-2016','01-06-2016') 
               and CopayType ="FBD" and FNRX=1 and pme_id in (46,42,55,38) 
               and 
               (
                 COBPrimaryRejectCode1 in ( '75','76')  
                 or COBPrimaryRejectCode2  in ('75','76') 
                 or COBPrimaryRejectCode3  in ('75','76')
               );
run;

I added formatting so you can see the clause better.

You want all the things above the () to be true AND the stuff inside the () to be true.

The stuff inside the () contains the or clauses. Having them ungrouped was causing your problems.

Upvotes: 1

Related Questions