<?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 Re: Like operator not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337731#M76751</link>
    <description>&lt;P&gt;I would use a hash iterator:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Master;
input pid details &amp;amp; : $100.;
cards;
101 The new NASA Software Catalogue includes the code LEWICE, developed to help study
102 core module will be followed by a series of launches for other components of the space
103 Pateinst suffered with ASTHMA
104 Surgery is the best way to remove tumor from Pain
105 Trial need patient with heart burn earlier
106 Clinical trial do not require volunteer with allergicasthmA.
;
run;

data event;
input adv_event $15.;
cards;
death
asthma
heart burn 
;
run;

Data want_hash (Drop=rc);
  If _N_ eq 1 Then Do;
    Declare Hash H (Dataset:'event');
	Declare HIter HI ('H');
	H.Definekey('adv_event');
	H.Definedata('adv_event');
	H.Definedone();
	If 0 Then Set event;
  End;
  Set Master;
  rc=HI.First();
  Do While (not rc);
    If Find(UpCase(details),UpCase(Trim(adv_event))) Then Do;
      Output;
	  Leave;
	End;
	rc=HI.Next();
  End;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 Mar 2017 07:37:39 GMT</pubDate>
    <dc:creator>user24feb</dc:creator>
    <dc:date>2017-03-03T07:37:39Z</dc:date>
    <item>
      <title>Like operator not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337723#M76749</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;From the below two datasets, I want to search the string '&lt;SPAN&gt;adv_event' from child dataset in clob data type variable 'details' from master table. I wrote the below program but it is not working or Is there any alternative method.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;data Master;&lt;BR /&gt;input pid details &amp;amp; : $100.;&lt;BR /&gt;cards;&lt;/P&gt;
&lt;P&gt;101 The new NASA Software Catalogue includes the code LEWICE, developed to help study&lt;BR /&gt;102 core module will be followed by a series of launches for other components of the space&lt;BR /&gt;103 Pateinst suffered with ASTHMA&lt;BR /&gt;104 Surgery is the best way to remove tumor from Pain&lt;BR /&gt;105 Trial need patient with heart burn earlier&lt;BR /&gt;106 Clinical trial do not require volunteer with allergicasthmA.&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data event;&lt;BR /&gt;input adv_event $15.;&lt;BR /&gt;cards;&lt;BR /&gt;death&lt;BR /&gt;asthma&lt;BR /&gt;heart burn &lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table final as&lt;BR /&gt;select pid from master&lt;BR /&gt;where upper(compress(details)) like "%"||(select compress(upper(adv_event)) from event)||"%";&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;My output&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;TABLE width="171"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="88"&gt;pid&lt;/TD&gt;
&lt;TD width="83"&gt;adv_event&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;103&lt;/TD&gt;
&lt;TD&gt;asthma&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;105&lt;/TD&gt;
&lt;TD&gt;heart burn&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;106&lt;/TD&gt;
&lt;TD&gt;asthma&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Fri, 03 Mar 2017 06:38:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337723#M76749</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2017-03-03T06:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Like operator not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337731#M76751</link>
      <description>&lt;P&gt;I would use a hash iterator:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Master;
input pid details &amp;amp; : $100.;
cards;
101 The new NASA Software Catalogue includes the code LEWICE, developed to help study
102 core module will be followed by a series of launches for other components of the space
103 Pateinst suffered with ASTHMA
104 Surgery is the best way to remove tumor from Pain
105 Trial need patient with heart burn earlier
106 Clinical trial do not require volunteer with allergicasthmA.
;
run;

data event;
input adv_event $15.;
cards;
death
asthma
heart burn 
;
run;

Data want_hash (Drop=rc);
  If _N_ eq 1 Then Do;
    Declare Hash H (Dataset:'event');
	Declare HIter HI ('H');
	H.Definekey('adv_event');
	H.Definedata('adv_event');
	H.Definedone();
	If 0 Then Set event;
  End;
  Set Master;
  rc=HI.First();
  Do While (not rc);
    If Find(UpCase(details),UpCase(Trim(adv_event))) Then Do;
      Output;
	  Leave;
	End;
	rc=HI.Next();
  End;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Mar 2017 07:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337731#M76751</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2017-03-03T07:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Like operator not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337755#M76762</link>
      <description>&lt;PRE&gt;data _null_;
  set event end=last;
  if _n_=1 then call execute('data want; set master; length adv_event $200;');
  call execute(cats('if index(upcase(details),"',upcase(adv_event),'") &amp;gt; 0 then adv_event="',adv_event,'";'));
  if last then call execute('run;');
run;&lt;/PRE&gt;
&lt;P&gt;The above will generate a datastep containing an if for eah obs in event. &amp;nbsp;Questions however, what happens if more than one appears in a row, what about part of a word, e.g. ASTHMAtic?&lt;/P&gt;
&lt;P&gt;You can also use merging:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table FINAL as
  select A.PID,
           B.ADV_EVENT 
  from   MASTER A
  left join EVENT B
  on      index(upcase(A.DETAILS),upcase(B.ADV_EVENT)) &amp;gt; 0;
quit;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Mar 2017 09:31:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337755#M76762</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-03T09:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Like operator not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337769#M76772</link>
      <description>&lt;PRE&gt;

 
data Master;
input pid details &amp;amp; : $100.;
cards;
101 The new NASA Software Catalogue includes the code LEWICE, developed to help study
102 core module will be followed by a series of launches for other components of the space
103 Pateinst suffered with ASTHMA
104 Surgery is the best way to remove tumor from Pain
105 Trial need patient with heart burn earlier
106 Clinical trial do not require volunteer with allergicasthmA.
;
run;
data event;
input adv_event $15.;
cards;
death
asthma
heart burn 
;
run;
proc sql;
create table final as
select pid from master as a,event as b
where upper(compress(details)) contains compress(upper(adv_event));
quit;


&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Mar 2017 10:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337769#M76772</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-03-03T10:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Like operator not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337840#M76793</link>
      <description>&lt;P&gt;Thank you very much everyone for your support and help&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 14:43:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Like-operator-not-working/m-p/337840#M76793</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2017-03-03T14:43:58Z</dc:date>
    </item>
  </channel>
</rss>

