Hello,
I am trying to delete the observation that does NOT contain "Card", and I am doing it in the data step. it gave me error on the =* and delete. I am not too sure what was wrong with it, can you please help?
can I do this in the sql step??
Thank you.
data want;
set have;
if acct_name not =* 'CARD' then delete;
run;
Sounds like is a SQL operator, not a data step operator.
But you could use it in a WHERE statement, use a SQL query instead or use the FIND or INDEX functions in place of it. One thing the INDEX and FIND can do is ignore case, if specified to do so.
You can use the contains operator in a datastep where clause. e.g.:
data want; set have (where=(acct_name contains 'CARD')); run;
HTH,
Art, CEO, AnalystFinder.com
While IF and WHERE are largely interchangeable from a syntax view point, some operators or functions can only be used in one of them.
WHERE can use operators such as like, contains, sounds like, or between as they come from the SQL world where WHERE clauses are used.
IF can use functions such as lag or vvalue or attrn as these belong firmly to the SAS world only.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.