BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
avatar
Fluorite | Level 6

I Would like to remove supplies from  file. below code does not work. it works only for one supply. when combined   , it does not remove  .

any other way to remove all at once.

AND  (A.PROD_1_DESC NOT LIKE 'ADAPTER%' OR A.PROD_1_DESC NOT LIKE 'AUVI-Q%'

OR A.PROD_1_DESC NOT LIKE 'AVOSTARTGRIP%'

OR A.PROD_1_DESC NOT LIKE 'CATH++%' OR A.PROD_1_DESC NOT LIKE 'CLAVE%'

OR A.PROD_1_DESC NOT LIKE 'CONNECTOR%' OR A.PROD_1_DESC NOT LIKE 'CRONO SYRINGE%'

OR A.PROD_1_DESC NOT LIKE 'DRESSING%' OR A.PROD_1_DESC NOT LIKE  'FILTER%'

OR A.PROD_1_DESC NOT LIKE 'GRIPPER%' OR A.PROD_1_DESC NOT LIKE 'HUBER%'

 

Please help.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Your logic is incorrect.  Change OR to AND.  

View solution in original post

4 REPLIES 4
ballardw
Super User

You could include all of the code, an example data set that demonstrates the behavior and what you expect the result to be. Best is to post example data in the form of a data step so we can actually test code against your data and to post all code in a code box opened with the forum {I} icon.

 

When you have "something and (<a bunch of OR comparisons>) the part before the AND is significant as well.

 

Astounding
PROC Star

Your logic is incorrect.  Change OR to AND.  

TomKari
Onyx | Level 15

ANDs and ORs with NOTs are tricky. If you think about it, with

 

VAR1 NOT LIKE 'A' OR VAR1 NOT LIKE 'B'

 

if Var1 is 'A', it is not like 'B'. If it's 'B', it's not like 'A'. So you always pass the test.

 

As suggested above, change OR to AND, or use the structure

 

NOT (LIKE 'A' OR LIKE 'B' OR LIKE 'C')

 

Tom

 

avatar
Fluorite | Level 6

Thank you all very much !!!!. Now I understand how this works.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 9644 views
  • 2 likes
  • 4 in conversation