<?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: generating frequency table for the words? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845903#M334419</link>
    <description>&lt;P&gt;Please post your data as a data step (and not a .csv file), like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input investor $200.;
datalines;
investor
3A Capital Services Limited
3A Capital Services Ltd
A M M Vellayan Sons P Ltd
Aadi Financial Advisors Llp
Aagam Holdings Private Limited
Abakkus Emerging Opportunities Fund-1
Abakkus Growth Fund-1
Aberdeen Global Indian Equity Fund Mauritius Ltd
;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you just need to count the occurrencies of words, create a table with all the words (in upper case, as you do not care about case):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data words;
  length word $30;
  set have;
  investor=upcase(investor);
  do _N_=1 to countw(investor,' ');
    word=scan(investor,_N_,' ');
	output;
	end;
  keep word;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use e.g. PROC SUMMARY to get the total counts:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=words nway;
  class word;
  output out=want(drop=_type_ rename=(_freq_=frequency));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 23 Nov 2022 12:11:12 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2022-11-23T12:11:12Z</dc:date>
    <item>
      <title>generating frequency table for the words?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845409#M334223</link>
      <description>&lt;P&gt;dear all&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have my data in the following format&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;investor&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3A Capital Services Limited&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3A Capital Services Ltd&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A M M Vellayan Sons P Ltd&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Aadi Financial Advisors Llp&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Aagam Holdings Private Limited&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Abakkus Emerging Opportunities Fund-1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Abakkus Growth Fund-1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Aberdeen Global Indian Equity Fund Mauritius Ltd&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to generate a frequency table for the words repeated in the above table&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need the output in the following format&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;word&lt;/TD&gt;&lt;TD&gt;frequency&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3A&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;capital&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;services&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt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t;&lt;P&gt;thanking you in advance&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 07:13:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845409#M334223</guid>
      <dc:creator>srikanthyadav44</dc:creator>
      <dc:date>2022-11-21T07:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: generating frequency table for the words?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845411#M334224</link>
      <description>&lt;P&gt;Why is "M" twice in the result? Are the words "Ltd" and "ltd" the same? What have you tried? &lt;/P&gt;
&lt;P&gt;First idea: a loop with scan to get the words, a hash-object to count.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 07:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845411#M334224</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-11-21T07:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: generating frequency table for the words?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845424#M334226</link>
      <description>&lt;P&gt;First, expand the dataset so that you have one word only in your variable (DO loop, COUNTW, SCAN, OUTPUT).&lt;/P&gt;
&lt;P&gt;Then run PROC FREQ on that.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 08:02:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845424#M334226</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-21T08:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: generating frequency table for the words?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845434#M334231</link>
      <description>just as an example, i have shown it. Ltd and ltd are the same.&lt;BR /&gt;SAS treats them as same,its great</description>
      <pubDate>Mon, 21 Nov 2022 09:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845434#M334231</guid>
      <dc:creator>srikanthyadav44</dc:creator>
      <dc:date>2022-11-21T09:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: generating frequency table for the words?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845437#M334232</link>
      <description>&lt;P&gt;Ltd and ltd are different strings. If you want these to be considered identical, you need to convert them to a common upper or lower case.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 10:35:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845437#M334232</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-21T10:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: generating frequency table for the words?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845440#M334233</link>
      <description>&lt;P&gt;can you please write the SAS CODE&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 10:52:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845440#M334233</guid>
      <dc:creator>srikanthyadav44</dc:creator>
      <dc:date>2022-11-21T10:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: generating frequency table for the words?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845441#M334234</link>
      <description>&lt;DIV class=""&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_blank" rel="noopener"&gt;Dear Mr. Kurt_Bremser&lt;/A&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;can you please show me the SAS code&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;i am not able to do it&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;thanking you in advance&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 21 Nov 2022 10:54:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845441#M334234</guid>
      <dc:creator>srikanthyadav44</dc:creator>
      <dc:date>2022-11-21T10:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: generating frequency table for the words?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845444#M334235</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/280123"&gt;@srikanthyadav44&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;can you please write the SAS CODE&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanking you in advance&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p1cydk5fq0u4bfn1xfbjt7w1c7lu.htm" target="_blank" rel="noopener"&gt;DO Statement: Iterative&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p18xi2516ihygyn1qg1b1nby326k.htm" target="_blank" rel="noopener"&gt;COUNTW Function&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0jshdjy2z9zdzn1h7k90u99lyq6.htm" target="_blank" rel="noopener"&gt;SCAN Function&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1lltvbis7ye1an1eryo4leh2mck.htm" target="_blank" rel="noopener"&gt;OUTPUT Statement&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have given you descriptions of the code. You were equipped at birth with a brain, so please use it.&lt;/P&gt;
&lt;P&gt;If you need someone to do your whole work, hire someone.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 11:02:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845444#M334235</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-21T11:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: generating frequency table for the words?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845903#M334419</link>
      <description>&lt;P&gt;Please post your data as a data step (and not a .csv file), like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input investor $200.;
datalines;
investor
3A Capital Services Limited
3A Capital Services Ltd
A M M Vellayan Sons P Ltd
Aadi Financial Advisors Llp
Aagam Holdings Private Limited
Abakkus Emerging Opportunities Fund-1
Abakkus Growth Fund-1
Aberdeen Global Indian Equity Fund Mauritius Ltd
;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you just need to count the occurrencies of words, create a table with all the words (in upper case, as you do not care about case):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data words;
  length word $30;
  set have;
  investor=upcase(investor);
  do _N_=1 to countw(investor,' ');
    word=scan(investor,_N_,' ');
	output;
	end;
  keep word;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use e.g. PROC SUMMARY to get the total counts:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=words nway;
  class word;
  output out=want(drop=_type_ rename=(_freq_=frequency));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Nov 2022 12:11:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-frequency-table-for-the-words/m-p/845903#M334419</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2022-11-23T12:11:12Z</dc:date>
    </item>
  </channel>
</rss>

