- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a query where i am using the if statement and i need to find the string matching the variable given.
if lead_status in ( '%APPROVED',
'%APPROVAL PENDING',
'%SEND TO SALES',
''
)
And this not reading or working...!
This is in a data step!.
Appreciate your help and genuine support
Thanks
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Either modify your program logic so that you can use a WHERE statement instead of an IF statement.
where (x like '%xxx') or (x like '%yyy') ;
Or use some other method to test the values in your IF statement.
Perhaps you can use PRXMATCH() function instead?
Editor's Note:
As Reeza noted, the like function is not available for IF conditions, but rather for WHERE statements. Also including Ksharp's example of PRXMATCH() syntax:
if prxmatch('/APPROVED$|APPROVAL PENDING$|SEND TO SALES$/i',strip(lead_status));
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Either modify your program logic so that you can use a WHERE statement instead of an IF statement.
where (x like '%xxx') or (x like '%yyy') ;
Or use some other method to test the values in your IF statement.
Perhaps you can use PRXMATCH() function instead?
Editor's Note:
As Reeza noted, the like function is not available for IF conditions, but rather for WHERE statements. Also including Ksharp's example of PRXMATCH() syntax:
if prxmatch('/APPROVED$|APPROVAL PENDING$|SEND TO SALES$/i',strip(lead_status));
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Similar functions that you could use in an IF statement are FIND(), FINDW(), INDEX/W() and Regex.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
if prxmatch('/APPROVED$|APPROVAL PENDING$|SEND TO SALES$/i',strip(lead_status));