02-28-2017 06:07 PM
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??
if acct_name not =* 'CARD' then delete;
02-28-2017 06:12 PM
02-28-2017 06:16 PM
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.
02-28-2017 06:27 PM
You can use the contains operator in a datastep where clause. e.g.:
data want; set have (where=(acct_name contains 'CARD')); run;
Art, CEO, AnalystFinder.com
02-28-2017 07:43 PM - edited 02-28-2017 07:44 PM
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.