<?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: return observation by finding a character within a sentence in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492213#M129317</link>
    <description>&lt;P&gt;Another possibility is to use a WHERE clause. May be faster:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  where desc like '%med%';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or, if you want&amp;nbsp;both upper and lowercase:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  where upcase(desc) like '%MED%';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Sep 2018 07:44:20 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2018-09-04T07:44:20Z</dc:date>
    <item>
      <title>return observation by finding a character within a sentence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492105#M129272</link>
      <description>&lt;P&gt;I want to return any observation that contains the word "med" in any place in a variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp;desc&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp;one medication at a time&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp;two medication at a time&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp;none&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 19:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492105#M129272</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2018-09-03T19:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: return observation by finding a character within a sentence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492106#M129273</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID   desc &amp;amp; $30. ;
cards;
1   one medication at a time
2   two medication at a time
3   none    
;

data want;
set have;
if find(desc,'med')&amp;gt;0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Sep 2018 19:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492106#M129273</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-03T19:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: return observation by finding a character within a sentence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492121#M129277</link>
      <description>&lt;P&gt;If I may be so bold as to suggest an improvement to the code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;find&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;desc&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'med','i'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This finds the letters med regardless of whether they are uppercase or lowercase. &lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 22:52:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492121#M129277</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-09-03T22:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: return observation by finding a character within a sentence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492124#M129280</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If I may be so bold as to suggest an improvement to the code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Of course stat champ sir. i always am in awe of your quantitative acumen on stats domain. Fall qtr starts tomorrow as PCA, logistic will go full throttle.Will reach out for guidance and help on that thread &lt;A href="https://communities.sas.com/t5/SAS-Statistical-Procedures/Requesting-guidance-for-Principal-component-analysis-amp-Factor/m-p/487828#M25306" target="_blank"&gt;https://communities.sas.com/t5/SAS-Statistical-Procedures/Requesting-guidance-for-Principal-component-analysis-amp-Factor/m-p/487828#M25306&lt;/A&gt;. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; have a great evening&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 23:15:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492124#M129280</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-03T23:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: return observation by finding a character within a sentence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492152#M129292</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;I want to return any observation that contains the word "med" in any place in a variable&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;"med" is not a word in your example, just a substring. "&lt;SPAN&gt;medication"&amp;nbsp;is a word.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Looking for words&amp;nbsp;is different than looking for strings. Be careful and exact when phrasing your questions.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 02:52:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492152#M129292</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-09-04T02:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: return observation by finding a character within a sentence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492213#M129317</link>
      <description>&lt;P&gt;Another possibility is to use a WHERE clause. May be faster:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  where desc like '%med%';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or, if you want&amp;nbsp;both upper and lowercase:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  where upcase(desc) like '%MED%';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 07:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492213#M129317</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-09-04T07:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: return observation by finding a character within a sentence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492259#M129336</link>
      <description>&lt;P&gt;Thank you, the upper/lower case addition is much needed!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 12:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/return-observation-by-finding-a-character-within-a-sentence/m-p/492259#M129336</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2018-09-04T12:34:41Z</dc:date>
    </item>
  </channel>
</rss>

