<?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: find words in string in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597255#M16121</link>
    <description>&lt;P&gt;Anytime &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; please mark my reply as the solution. This helps future users navigate the community.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2019 10:52:03 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-10-17T10:52:03Z</dc:date>
    <item>
      <title>find words in string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597231#M16113</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;respondents to a survey indicated a list of names (fiction authors), and they were recorded in a single variable, separated by a comma.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thus,&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;OBS&lt;/TD&gt;&lt;TD&gt;string&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Toni Morrison&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Kurt Vonnegut&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,Harper Lee&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,T.S. Eliot,Toni Morrison, Danielle Steel&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Robert Ludlum&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,James Patterson&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,Tom Clancy&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,Danielle Steel&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,John Grisham&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create a new variable (NEW) that has the frequency of CERTAIN authors. That is, the NEW should not simply count the number of words in STRING. For instance, I want NEW to count Morrison and Steel. So to obtain the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;OBS&lt;/TD&gt;&lt;TD&gt;string&lt;/TD&gt;&lt;TD&gt;NEW&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Toni Morrison&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Kurt Vonnegut&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,Harper Lee&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,T.S. Eliot,Toni Morrison, Danielle Steel&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Robert Ludlum&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,James Patterson&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,Tom Clancy&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,Danielle Steel&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;,John Grisham&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having troubles finding a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestion would be greatly appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eman&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 09:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597231#M16113</guid>
      <dc:creator>emaneman</dc:creator>
      <dc:date>2019-10-17T09:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: find words in string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597241#M16119</link>
      <description>&lt;P&gt;One way&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input OBS string : $ 3-203;
infile datalines4 dlm='|';
datalines;
1|Toni Morrison   
2|Kurt Vonnegut   ,Harper Lee   ,T.S. Eliot,Toni Morrison, Danielle Steel
3|Robert Ludlum   ,James Patterson   ,Tom Clancy   ,Danielle Steel   ,John Grisham
;

data want(drop=i);
    set have;
    new=0;
    do i=1 to countw(string);
        if propcase(scan(string, i)) in ('Morrison', 'Steel') then new+1;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Oct 2019 10:39:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597241#M16119</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-17T10:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: find words in string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597252#M16120</link>
      <description>&lt;P&gt;Thank you! Elegant, and fast.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I love this community.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 10:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597252#M16120</guid>
      <dc:creator>emaneman</dc:creator>
      <dc:date>2019-10-17T10:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: find words in string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597255#M16121</link>
      <description>&lt;P&gt;Anytime &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; please mark my reply as the solution. This helps future users navigate the community.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 10:52:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597255#M16121</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-17T10:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: find words in string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597257#M16123</link>
      <description>&lt;P&gt;done, thank you again.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 10:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/find-words-in-string/m-p/597257#M16123</guid>
      <dc:creator>emaneman</dc:creator>
      <dc:date>2019-10-17T10:56:23Z</dc:date>
    </item>
  </channel>
</rss>

