<?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: removing abbreviations in firm names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/removing-abbreviations-in-firm-names/m-p/532944#M146077</link>
    <description>&lt;P&gt;If it has delimeters, then use that, e.g:&lt;/P&gt;
&lt;PRE&gt;data want;
  length want $200;
  test="Something co";
  do i=1 to countw(test," ");
    if scan(test,i," ") ne "co" then want=catx(" ",want,scan(test,i," "));
  end;
run;&lt;/PRE&gt;
&lt;P&gt;Of course that is only showing one removal and with spaces, but you get the idea, and no test data in the form of a datastep prevents anything further.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Feb 2019 14:57:32 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2019-02-05T14:57:32Z</dc:date>
    <item>
      <title>removing abbreviations in firm names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-abbreviations-in-firm-names/m-p/532935#M146075</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i'm trying to match two different firm names using COMPGED (maybe SPECID, SOUNDEX can be used as alternative method)&lt;/P&gt;&lt;P&gt;but before that, I am thinking of making firm names similar as possible, by removing abbreviations at the end&lt;/P&gt;&lt;P&gt;(e.g:&amp;nbsp;CO LTD, PTE LTD, Limited, INC, Incorporated, AG, SpA, Corp)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;simplest way would be using the function TRANWRD, but i'm afraid this would replace not only abbreviations but letters that are part of the firm names. (say, if I was trying to remove 'Corp' at the end of firm names but by using TRANWRD i made 'Corpastta SpA' to 'astta SpA')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thus, what is the best way to do this and has anyone done the same work as me?&lt;/P&gt;&lt;P&gt;maybe I should use reg expression?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 14:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-abbreviations-in-firm-names/m-p/532935#M146075</guid>
      <dc:creator>jimmychoi</dc:creator>
      <dc:date>2019-02-05T14:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: removing abbreviations in firm names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-abbreviations-in-firm-names/m-p/532937#M146076</link>
      <description>&lt;P&gt;Please post example data in a usable form. See &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; for details on how to create usable data.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 14:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-abbreviations-in-firm-names/m-p/532937#M146076</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-02-05T14:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: removing abbreviations in firm names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-abbreviations-in-firm-names/m-p/532944#M146077</link>
      <description>&lt;P&gt;If it has delimeters, then use that, e.g:&lt;/P&gt;
&lt;PRE&gt;data want;
  length want $200;
  test="Something co";
  do i=1 to countw(test," ");
    if scan(test,i," ") ne "co" then want=catx(" ",want,scan(test,i," "));
  end;
run;&lt;/PRE&gt;
&lt;P&gt;Of course that is only showing one removal and with spaces, but you get the idea, and no test data in the form of a datastep prevents anything further.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 14:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-abbreviations-in-firm-names/m-p/532944#M146077</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-05T14:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: removing abbreviations in firm names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-abbreviations-in-firm-names/m-p/533012#M146096</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use perl regular expression for pattern matching.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines truncover;
input word $50.;
datalines;
Corpastta AB Crop
Corpastta Crop AB
AB Corpastta Crop
AB Corpastta
Crop AB Corpastta
ABCrop Corpastta
;
run;

data want;
set have;
position=prxmatch('m/ Crop | Crop|^Crop /io',word);
new_word1=ifc(position^=0,ifc(position&amp;gt;1,substr(word,1,prxmatch('m/ Crop | Crop|^Crop /io',word)-1),''),word);
new_word2=ifc(position^=0,substr(word,prxmatch('m/ Crop | Crop|^Crop /io',word)+5),'');
required_word=catx(' ',new_word1,new_word2);
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You need to include the blanks for the strings that your looking for.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;'m/ Crop | Crop|^Crop /io'&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|_ ^(cap) for starting of the word and blank at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|_______ Starting with blank and ends the line&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |_______________ Blank at starting and ending.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 17:04:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-abbreviations-in-firm-names/m-p/533012#M146096</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2019-02-05T17:04:20Z</dc:date>
    </item>
  </channel>
</rss>

