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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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