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.

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 9138 views
  • 2 likes
  • 4 in conversation