<?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 Frequency of Strings in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41378#M10688</link>
    <description>Is there a way to count the frequency of strings within a character variable? I want to display a count of more commonly used words within a long character variable. Thanks!</description>
    <pubDate>Fri, 22 Aug 2008 18:59:48 GMT</pubDate>
    <dc:creator>rrr</dc:creator>
    <dc:date>2008-08-22T18:59:48Z</dc:date>
    <item>
      <title>Frequency of Strings</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41378#M10688</link>
      <description>Is there a way to count the frequency of strings within a character variable? I want to display a count of more commonly used words within a long character variable. Thanks!</description>
      <pubDate>Fri, 22 Aug 2008 18:59:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41378#M10688</guid>
      <dc:creator>rrr</dc:creator>
      <dc:date>2008-08-22T18:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency of Strings</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41379#M10689</link>
      <description>Hi:&lt;BR /&gt;
  do you mean that you have a list of words (a, an, the, and) that you're looking for -- or your want to take a text string and find out the most common words in a string??? &lt;BR /&gt;
&lt;BR /&gt;
  This may be a job for Text Miner:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/onlinedoc/txtminer/getstarted31.pdf" target="_blank"&gt;http://support.sas.com/documentation/onlinedoc/txtminer/getstarted31.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
but in a Base SAS world, there's always writing out your "words" and then doing PROC FREQ on them.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 22 Aug 2008 22:19:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41379#M10689</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-08-22T22:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency of Strings</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41380#M10690</link>
      <description>If you already know what words to look for, the countw function may be of interest.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Linus</description>
      <pubDate>Mon, 25 Aug 2008 09:26:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41380#M10690</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-08-25T09:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency of Strings</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41381#M10691</link>
      <description>&amp;gt; Hi:&lt;BR /&gt;
&amp;gt; do you mean that you have a list of words (a, an,&lt;BR /&gt;
&amp;gt; the, and) that you're looking for -- or your want to&lt;BR /&gt;
&amp;gt; take a text string and find out the most common&lt;BR /&gt;
&amp;gt;  words in a string??? &lt;BR /&gt;
&amp;gt; &amp;gt; &lt;BR /&gt;
&amp;gt; but in a Base SAS world, there's always writing out&lt;BR /&gt;
&amp;gt; your "words" and then doing PROC FREQ on them.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; cynthia&lt;BR /&gt;
&lt;BR /&gt;
I would like to take the text string and find the most common words in the string. Is there a way to do that without using the Text Miner?  If I have to, I could estimate the common words and use the countw function. Thanks for your help!</description>
      <pubDate>Tue, 26 Aug 2008 12:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41381#M10691</guid>
      <dc:creator>rrr</dc:creator>
      <dc:date>2008-08-26T12:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency of Strings</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41382#M10692</link>
      <description>If you want to count words for all rows together I think you should take out each word of the string, output them, and then do a PROC FREQ as Cynthia suggested. To do that you'll probably use some kind of do until logic together with the scan function and the output statement.&lt;BR /&gt;
&lt;BR /&gt;
Linus</description>
      <pubDate>Tue, 26 Aug 2008 13:22:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41382#M10692</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-08-26T13:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency of Strings</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41383#M10693</link>
      <description>&lt;P&gt;Hi..&lt;BR /&gt; Leftover from my days as a Lit major, I wrote this program to do a frequency count of the words in the first chapter of Melville's "Moby Dick". &lt;BR /&gt; &lt;BR /&gt; Interestingly enough, after you eliminate all the articles and prepositions and pronouns, the most frequently used word in the first chapter of Moby Dick is 'sea' (13 times) followed by 'water' (8 times). The words 'ship', 'soul', 'man' and 'whale' each occur 3 times. Anyway, the relevant part of that program is shown below -- I had to get rid of a stray '?' in the chapter, which is why the compress is in the code. Also, I turned everything to lower case, so 'The' and 'the' would get counted the same when I did a frequency on the WORD variable.&lt;BR /&gt; &lt;BR /&gt; cynthia&lt;BR /&gt; &lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;** now break apart each line into separate lowercase words;
** but keep the word order (wordord) and the original capitalization (origword);
data cnt_chp1(keep=chapter pgno paracnt linenum wordord origword word);
    set moby_ch1;
    i = 1;
    origword = scan(record,i);
    word = compress(lowcase(origword),'?');
    wordord = i;
    do until (origword = ' ');
        output;
        i + 1;
        wordord = i;
        origword = scan(record,i);
        word = compress(lowcase(origword),'?');
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Mar 2016 16:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41383#M10693</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-03-25T16:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency of Strings</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41384#M10694</link>
      <description>Be honest now - when you read the book originally, did you skip the 'Whaling Chapters'?</description>
      <pubDate>Tue, 02 Sep 2008 14:01:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41384#M10694</guid>
      <dc:creator>mftuchman</dc:creator>
      <dc:date>2008-09-02T14:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency of Strings</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41385#M10695</link>
      <description>Hi:&lt;BR /&gt;
  Not the first time or the second time. But by the third time I read it, yes, I did skip the whaling chapters.&lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 02 Sep 2008 14:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Frequency-of-Strings/m-p/41385#M10695</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-09-02T14:13:13Z</dc:date>
    </item>
  </channel>
</rss>

