<?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: Abbreviate company names by selecting first characters of words in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517442#M139897</link>
    <description>&lt;P&gt;to accomplish the same we need to first compress or remove the words which are not part of the acronym like, 'the' 'for' 'of' etc.,&lt;/P&gt;
&lt;P&gt;then we need to take the first letter from the remaining words which form the acronym and combine them to form the acronym.&lt;/P&gt;
&lt;P&gt;I tried the same in the following code which derives the variable acronym which could be compare with the acronym from another source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input text &amp;amp;:$200.;
countw=countw(text);
array cnt(*)$ char1-char100;
do i = 1 to countw;
cnt(i)=first(scan(prxchange('s/the|for|of//i',-1,text),i,''));
end;
acronym=cats(of char1-char100);
cards;
THE INTERNATIONAL COMPANY FOR ELECTRICITY SUPPLY 
REGIONAL COMPANY OF DEVELOPMENT
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 30 Nov 2018 12:28:34 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2018-11-30T12:28:34Z</dc:date>
    <item>
      <title>Abbreviate company names by selecting first characters of words</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517438#M139893</link>
      <description>&lt;P&gt;I want to create a new variable (ABBR) that forms the abbreviation of another variable containing company names (Company) by selecting the first letters of the words in the name. However, I would like to avoid getting the first character of words like 'the" "for" "in" ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;THE INTERNATIONAL COMPANY FOR ELECTRICITY SUPPLY --&amp;gt;&amp;nbsp; ICES&lt;/P&gt;&lt;P&gt;REGIONAL COMPANY OF DEVELOPMENT&amp;nbsp; --&amp;gt; RCD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to match this with company names from another source which might contain only the abbreviation. This will not be flawless but might work on a small percentage of the unmatched cases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: There might be a trick using the PROPCASE function, but as a beginner with SAS I have no idea how to even begin (underneath is how far I got). Probably an alternative option is using SCAN function in a way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set have;
	UpcaseFirst = Propcase(Company);
	Abbr = Anyupper(UpcaseFirst);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 12:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517438#M139893</guid>
      <dc:creator>SarahDew</dc:creator>
      <dc:date>2018-11-30T12:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Abbreviate company names by selecting first characters of words</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517442#M139897</link>
      <description>&lt;P&gt;to accomplish the same we need to first compress or remove the words which are not part of the acronym like, 'the' 'for' 'of' etc.,&lt;/P&gt;
&lt;P&gt;then we need to take the first letter from the remaining words which form the acronym and combine them to form the acronym.&lt;/P&gt;
&lt;P&gt;I tried the same in the following code which derives the variable acronym which could be compare with the acronym from another source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input text &amp;amp;:$200.;
countw=countw(text);
array cnt(*)$ char1-char100;
do i = 1 to countw;
cnt(i)=first(scan(prxchange('s/the|for|of//i',-1,text),i,''));
end;
acronym=cats(of char1-char100);
cards;
THE INTERNATIONAL COMPANY FOR ELECTRICITY SUPPLY 
REGIONAL COMPANY OF DEVELOPMENT
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Nov 2018 12:28:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517442#M139897</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-11-30T12:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Abbreviate company names by selecting first characters of words</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517445#M139898</link>
      <description>&lt;P&gt;Another way of solving the problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;

   length 
      Abbr $ 20
      Word $ 100
   ;

   do i = 1 to countw(Company);
      Word = scan(Company, i);

      if not (trim(Word) in ('OF', 'THE', 'FOR')) then do;
         Abbr = cats(Abbr, first(Word));
      end;
   end;

   drop i word;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 12:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517445#M139898</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-11-30T12:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Abbreviate company names by selecting first characters of words</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517448#M139900</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;I would suggest&amp;nbsp;modifying&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Word &lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Company&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN&gt; i&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;CODE class=" language-sas"&gt;
/*TO*/&lt;BR /&gt;
&lt;SPAN&gt;Word &lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; upcase( &lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Company&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN&gt; i&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;) )&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 13:01:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517448#M139900</guid>
      <dc:creator>DanielLangley</dc:creator>
      <dc:date>2018-11-30T13:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Abbreviate company names by selecting first characters of words</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517451#M139902</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209943"&gt;@DanielLangley&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;I would suggest&amp;nbsp;modifying&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Word &lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Company&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN&gt; i&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;CODE class=" language-sas"&gt;
/*TO*/&lt;BR /&gt;
&lt;SPAN&gt;Word &lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; upcase( &lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Company&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN&gt; i&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;) )&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well, of course, good idea.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 13:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517451#M139902</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-11-30T13:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Abbreviate company names by selecting first characters of words</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517465#M139910</link>
      <description>&lt;P&gt;This works partially but can it be that this code also removes a part when a string starts with a "banned" word?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for example turns:&lt;/P&gt;&lt;P&gt;&lt;U&gt;OF&lt;/U&gt;FICIAL COMPANY &lt;U&gt;OF&lt;/U&gt; COMPUTERS first to FICIAL COMPANY COMPUTERS to acronym FCC instead of OCC?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 13:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Abbreviate-company-names-by-selecting-first-characters-of-words/m-p/517465#M139910</guid>
      <dc:creator>SarahDew</dc:creator>
      <dc:date>2018-11-30T13:50:27Z</dc:date>
    </item>
  </channel>
</rss>

