<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Case Statement Like With Multiple Values in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427254#M27521</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a case statement, I have multiple values I was to catch in a url code. Since the full urls vary, but with a few strings that are consistently embedded within it, I want to catch them all by asking for like '%string%'. However, I don't know how to do that within a case statement and with multiple possibilities.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when activity_id = 2 and link_name like in ('%CUSTSERV%' , '%CUSTOMER%', '%SERVICE%') then 1 else 0 end as cust_serv,&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for the help ahead of time.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jan 2018 16:36:42 GMT</pubDate>
    <dc:creator>Dogo23</dc:creator>
    <dc:date>2018-01-12T16:36:42Z</dc:date>
    <item>
      <title>Case Statement Like With Multiple Values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427254#M27521</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a case statement, I have multiple values I was to catch in a url code. Since the full urls vary, but with a few strings that are consistently embedded within it, I want to catch them all by asking for like '%string%'. However, I don't know how to do that within a case statement and with multiple possibilities.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when activity_id = 2 and link_name like in ('%CUSTSERV%' , '%CUSTOMER%', '%SERVICE%') then 1 else 0 end as cust_serv,&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for the help ahead of time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 16:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427254#M27521</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-01-12T16:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement Like With Multiple Values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427264#M27523</link>
      <description>&lt;P&gt;It never hurts to provide some example data in the form of a data step that demonstrates what you have and then what you want the result for that data to be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may be that a data step is more flexible for multiple OR comparisons. I don't think "in" operator is going to work the way you are thinking.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 16:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427264#M27523</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-12T16:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement Like With Multiple Values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427266#M27524</link>
      <description>&lt;P&gt;case when activity_id = 2 and (link_name like&amp;nbsp; '%CUSTSERV%' or link_name like '%CUSTOMER%' or link_name '%SERVICE%' ) then 1 else 0 end as cust_serv&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 16:46:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427266#M27524</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-12T16:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement Like With Multiple Values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427271#M27526</link>
      <description>&lt;P&gt;This worked, thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 16:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427271#M27526</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-01-12T16:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement Like With Multiple Values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427276#M27529</link>
      <description>&lt;P&gt;Just for completeness since OP 1) did not post data, 2) did not provide a lot of details, and 3) those playing along at home may have trouble following things:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data records;
   input id activity_id link_name:$200.;
datalines;
1105 1 whodoo_whoodoo_customer.asp
1106 1 whodate_customer_dare.html
1107 1 nothing_here_move_along.css
1108 2 has_a_target_customer_word.html
1109 2 does_not.html
1110 2 service.html
1111 2 this_is_custservice_now.html
1112 2 just_ignore_me
;
run;

proc sql;
	create table customer_ones as
	select 
		id,
		case 
			when activity_id = 2 and (link_name like '%custserv%' or link_name like '%customer%' or link_name like '%service%') 
			then 1 
			else 0 
		end as cust_serv
	from records;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And a note that it is case sensitive so that %CUSTOMER% is different than %customer%. &lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 17:03:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-Statement-Like-With-Multiple-Values/m-p/427276#M27529</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2018-01-12T17:03:15Z</dc:date>
    </item>
  </channel>
</rss>

