Oct 3, 2006 #1 nickdel Programmer Joined May 11, 2006 Messages 367 Location GB Do anyone know of an alternative to the LIKE operand that can used in an IF statement? What I'm trying to acheive is something like this: var_a = 'Hello' IF var_a like '%llo%' then do; output; end;
Do anyone know of an alternative to the LIKE operand that can used in an IF statement? What I'm trying to acheive is something like this: var_a = 'Hello' IF var_a like '%llo%' then do; output; end;
Oct 3, 2006 #2 klaz2002 Programmer Joined Nov 6, 2002 Messages 559 Location US You could use the index() function. Code: data test; set your_dataset; var_a = 'Hello' IF index(var_a,'llo') gt 0 then do; output; end; run; Klaz Upvote 0 Downvote
You could use the index() function. Code: data test; set your_dataset; var_a = 'Hello' IF index(var_a,'llo') gt 0 then do; output; end; run; Klaz