<?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 Identify the multiple positions of the same word in a String in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Identify-the-multiple-positions-of-the-same-word-in-a-String/m-p/587389#M14681</link>
    <description>&lt;P&gt;Hello SAS experts,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question regarding identify the multiple positions of the same word in a string. For example, I have a string containing all the medical chart notes and I want to identify the positions of the word insulin used in the note every time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The note is like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;Insulin&lt;/STRONG&gt; &lt;/U&gt;&lt;/FONT&gt;glargine increased to 85 units twice a day. This may not be the right&amp;nbsp;level to control your blood sugar, and so you will be called Saturday 9/7/13 to&amp;nbsp;see how your blood sugar levels are doing. You will likely only need to continue&amp;nbsp;with this higher dose of &lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;insulin&lt;/STRONG&gt; &lt;/U&gt;&lt;/FONT&gt;while you are taking steroids.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;INSULIN&lt;/STRONG&gt; &lt;/U&gt;&lt;/FONT&gt;GLARGINE INJ&lt;/P&gt;&lt;P&gt;Directions: inject 85units under the skin twice a day do not mix with other&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;U&gt;insulins&lt;/U&gt;&lt;/STRONG&gt;&lt;/FONT&gt;, discard open vials after 28 days&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;INSULIN&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;,ASPART 100UN/ML NOVO FLEXPEN 3ML&lt;/P&gt;&lt;P&gt;Directions: Inject sliding scale under the skin before meals and at bedtime (for&amp;nbsp;diabetes) , use this scale to determine &lt;STRONG&gt;&lt;U&gt;&lt;FONT color="#FF0000"&gt;insulin&lt;/FONT&gt; &lt;/U&gt;&lt;/STRONG&gt;dose.for blood sugar "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have boldened, reddened and underlined the keyword insulin, which also have lower/upper case change. Is there a way to output the position for each insulin used, such as insulin_pos1=50, insulin_pos2=100, insulin_pos3=150, etc?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2019 00:46:07 GMT</pubDate>
    <dc:creator>BochengJing</dc:creator>
    <dc:date>2019-09-10T00:46:07Z</dc:date>
    <item>
      <title>Identify the multiple positions of the same word in a String</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identify-the-multiple-positions-of-the-same-word-in-a-String/m-p/587389#M14681</link>
      <description>&lt;P&gt;Hello SAS experts,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question regarding identify the multiple positions of the same word in a string. For example, I have a string containing all the medical chart notes and I want to identify the positions of the word insulin used in the note every time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The note is like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;Insulin&lt;/STRONG&gt; &lt;/U&gt;&lt;/FONT&gt;glargine increased to 85 units twice a day. This may not be the right&amp;nbsp;level to control your blood sugar, and so you will be called Saturday 9/7/13 to&amp;nbsp;see how your blood sugar levels are doing. You will likely only need to continue&amp;nbsp;with this higher dose of &lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;insulin&lt;/STRONG&gt; &lt;/U&gt;&lt;/FONT&gt;while you are taking steroids.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;INSULIN&lt;/STRONG&gt; &lt;/U&gt;&lt;/FONT&gt;GLARGINE INJ&lt;/P&gt;&lt;P&gt;Directions: inject 85units under the skin twice a day do not mix with other&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;U&gt;insulins&lt;/U&gt;&lt;/STRONG&gt;&lt;/FONT&gt;, discard open vials after 28 days&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;INSULIN&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;,ASPART 100UN/ML NOVO FLEXPEN 3ML&lt;/P&gt;&lt;P&gt;Directions: Inject sliding scale under the skin before meals and at bedtime (for&amp;nbsp;diabetes) , use this scale to determine &lt;STRONG&gt;&lt;U&gt;&lt;FONT color="#FF0000"&gt;insulin&lt;/FONT&gt; &lt;/U&gt;&lt;/STRONG&gt;dose.for blood sugar "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have boldened, reddened and underlined the keyword insulin, which also have lower/upper case change. Is there a way to output the position for each insulin used, such as insulin_pos1=50, insulin_pos2=100, insulin_pos3=150, etc?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 00:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identify-the-multiple-positions-of-the-same-word-in-a-String/m-p/587389#M14681</guid>
      <dc:creator>BochengJing</dc:creator>
      <dc:date>2019-09-10T00:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Identify the multiple positions of the same word in a String</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identify-the-multiple-positions-of-the-same-word-in-a-String/m-p/587402#M14683</link>
      <description>&lt;P&gt;A few notes ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are probably better off using multiple observations instead of multiple variables.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obsno&amp;nbsp; Position&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 150&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the FIND function.&amp;nbsp; FINDW looks like it could help, but you would need to use it twice (once for "insulin" then again for "insulins").&amp;nbsp; FIND lets you find "insulin" and "insulins" at the same time by searching for "insulin".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It has options to ignore upper vs. lower case, and to begin the search after the starting position found by the previous search.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 02:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identify-the-multiple-positions-of-the-same-word-in-a-String/m-p/587402#M14683</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-09-10T02:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Identify the multiple positions of the same word in a String</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identify-the-multiple-positions-of-the-same-word-in-a-String/m-p/588406#M14794</link>
      <description>&lt;P&gt;The medical notes is super long -- it is one integration note sitting in one cell of the table. How do we convert it into multiple observations?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 23:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identify-the-multiple-positions-of-the-same-word-in-a-String/m-p/588406#M14794</guid>
      <dc:creator>BochengJing</dc:creator>
      <dc:date>2019-09-12T23:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Identify the multiple positions of the same word in a String</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identify-the-multiple-positions-of-the-same-word-in-a-String/m-p/588524#M14805</link>
      <description>&lt;P&gt;Here's the idea of how you can start out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   found=0;&lt;BR /&gt;   original_recno = _n_;
   do i=1 to 500 until (found=0);
      found = find(chart_notes, 'insulin', 'i', found+1);
      if found &amp;gt; 0 then output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This gives you an observation each time "insulin" is found (doesn't matter if it is upper or lower case).&amp;nbsp; FOUND is the position of "insulin" within the longer string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The resulting data set has a couple of flaws.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If "insulin" is not found at all, the observation is deleted entirely.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It assumes "insulin" will never be found more than 500 times in a single medical note.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data set may be large because the medical note gets repeated each time "insulin" is found.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Despite the potential flaws, this gives you something to work with, and you can consider what the best final form to the data would be.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 13:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identify-the-multiple-positions-of-the-same-word-in-a-String/m-p/588524#M14805</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-09-13T13:49:30Z</dc:date>
    </item>
  </channel>
</rss>

