<?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 remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540545#M149125</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I remove the 'THE' from the '&lt;CODE class=" language-sas"&gt;HRM_L2_Step3'variable which end in 'THE' and start with 'THE'.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;for example&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;for table a&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THKDNAWTHE &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;COIOMMOO THE &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THEDONNWWW &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THE DOCMESSC &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THE DOCMESS THE &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THEIMLEMTHE&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;I expect to get table&amp;nbsp;b&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THKDNAWTHE &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;COIOMMOO&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THEDONNWWW &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;DOCMESSC &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;DOCMESS&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THEIMLEMTHE&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;Could you please give me some suggestions? thanks in advance&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
  infile datalines dlm=',' truncover;
  informat HRM_L2_Step3 $50.;
input HRM_L2_Step3 ;
datalines;
THKDNAWTHE
COIOMMOO THE
THEDONNWWW
THE DOCMESSC
THE DOCMESS THE
THEIMLEMTHE
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2019 19:15:45 GMT</pubDate>
    <dc:creator>Alexxxxxxx</dc:creator>
    <dc:date>2019-03-05T19:15:45Z</dc:date>
    <item>
      <title>remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540545#M149125</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I remove the 'THE' from the '&lt;CODE class=" language-sas"&gt;HRM_L2_Step3'variable which end in 'THE' and start with 'THE'.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;for example&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;for table a&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THKDNAWTHE &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;COIOMMOO THE &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THEDONNWWW &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THE DOCMESSC &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THE DOCMESS THE &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THEIMLEMTHE&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;I expect to get table&amp;nbsp;b&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THKDNAWTHE &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;COIOMMOO&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THEDONNWWW &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;DOCMESSC &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;DOCMESS&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;THEIMLEMTHE&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;Could you please give me some suggestions? thanks in advance&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
  infile datalines dlm=',' truncover;
  informat HRM_L2_Step3 $50.;
input HRM_L2_Step3 ;
datalines;
THKDNAWTHE
COIOMMOO THE
THEDONNWWW
THE DOCMESSC
THE DOCMESS THE
THEIMLEMTHE
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 19:15:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540545#M149125</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-05T19:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540560#M149131</link>
      <description>&lt;P&gt;Here is one way&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
  infile datalines dlm=',' truncover;
  informat HRM_L2_Step3 $50.;
input HRM_L2_Step3 ;
datalines;
THKDNAWTHE
COIOMMOO THE
THEDONNWWW
THE DOCMESSC
THE DOCMESS THE
THEIMLEMTHE
run;

data b;
   set a;
   HRM_L2_Step3=prxchange('s/\sTHE|THE\s//',-1,HRM_L2_Step3);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Mar 2019 20:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540560#M149131</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-05T20:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540591#M149149</link>
      <description>&lt;P&gt;Tranwrd is nice for replacing text. The transtrN can replace text with "" (nothing).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp; set a;&lt;BR /&gt;&amp;nbsp; HRM_L2_Step3 = transtrN(HRM_L2_Step3,"THE",trimn(''));&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 21:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540591#M149149</guid>
      <dc:creator>noling</dc:creator>
      <dc:date>2019-03-05T21:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540597#M149153</link>
      <description>&lt;P&gt;Just in case the previous suggestions aren't 100% working, here is a possibility:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if HRM_L2_Step3 =: 'THE ' then HRM_L2_Step3 = substr(HRM_L2_Step3, 4);&lt;/P&gt;
&lt;P&gt;if scan(HRM_L2_Step3, -1) = 'THE' then&amp;nbsp;&lt;/P&gt;
&lt;P&gt;substr(HRM_L2_Step3, length(HRM_L2_Step3) - 2, 3) = '&amp;nbsp; &amp;nbsp;';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 21:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540597#M149153</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-05T21:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540618#M149165</link>
      <description>&lt;P&gt;Dear draycut,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please explain the meaning of '&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;prxchange&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'s/\sTHE|THE\s//'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really expect to know how it works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your attention to this matter.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 23:38:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540618#M149165</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-05T23:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540619#M149166</link>
      <description>&lt;P&gt;Sure, I will give it a try. However, if you are not &lt;FONT face="andale mono,times"&gt;familiar&lt;/FONT&gt; with regular expressions, some of it may not make sense &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0r8h2fa8djqf1n1cnenrvm573br.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;PRXCHANGE Functions&lt;/A&gt;&amp;nbsp;first argument is&lt;STRONG&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;'s/\sTHE|THE\s//'.&amp;nbsp;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;The first &lt;/SPAN&gt;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;s&lt;/SPAN&gt;&lt;/CODE&gt;&lt;STRONG&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt; means that I want to substitute the pattern between the first and second slash with the text between the second and third slash (in this case nothing). The&amp;nbsp;\sTHE means that I search for a pattern matching a whitespace followed by the string "THE". | is an 'or symbol', meaning that I search for a pattern matching either the string "THE" with a blank before OR after it.&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;The -1 in the next argument means that I keep searching for and replacing the matched patterns until the end of the input string.&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;Hope this makes sense&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 23:53:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540619#M149166</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-05T23:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540622#M149168</link>
      <description>I really appreciate your advice. I have understood your meaning</description>
      <pubDate>Wed, 06 Mar 2019 00:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540622#M149168</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-06T00:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540623#M149169</link>
      <description>&lt;P&gt;I'm glad you found your answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 00:18:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540623#M149169</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-06T00:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540628#M149171</link>
      <description>&lt;P&gt;Dear draycut,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I face a new problem during the process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not want&amp;nbsp;to remove the 'THE' form below observations during the process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AGI THERAPEUTICS&lt;/P&gt;&lt;P&gt;RAPEUTICSTHE&amp;nbsp;AGI&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please give me some suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 01:25:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540628#M149171</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-06T01:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540631#M149172</link>
      <description>&lt;P&gt;Dear Astounding,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, for 'THE DOCMESSC', I get '&amp;nbsp;DOCMESSC'. How can I remove the blank which before 'DOCMESSC'?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please give me some suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 01:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540631#M149172</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-06T01:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540632#M149173</link>
      <description>Sorry, my fault on this line:&lt;BR /&gt;&lt;BR /&gt;substr(HRM_L2_Step3, 4);&lt;BR /&gt;&lt;BR /&gt;Change it to:&lt;BR /&gt;&lt;BR /&gt;substr(HRM_L2_Step3, 5);</description>
      <pubDate>Wed, 06 Mar 2019 01:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540632#M149173</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-06T01:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540634#M149174</link>
      <description>&lt;P&gt;Thanks, Astounding, it works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I have a new problem during the process.&lt;/P&gt;&lt;P&gt;For 'THE * ALUMINIUM POWDER COMPANY', how can I remove 'THE * ' (i.e., only keep 'ALUMINIUM POWDER COMPANY')?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;besides, what will happen if I set&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;

set a;

if HRM_L2_Step3 =: 'THE ' then HRM_L2_Step3 = substr(HRM_L2_Step3, 5);

if scan(HRM_L2_Step3, -1) = 'THE' then

substr(HRM_L2_Step3, length(HRM_L2_Step3) - 2, 3) = &lt;U&gt;''&lt;/U&gt;;

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;rather than&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;

set a;

if HRM_L2_Step3 =: 'THE ' then HRM_L2_Step3 = substr(HRM_L2_Step3, 5);

if scan(HRM_L2_Step3, -1) = 'THE' then

substr(HRM_L2_Step3, length(HRM_L2_Step3) - 2, 3) =&amp;nbsp;&lt;U&gt;'&amp;nbsp; &amp;nbsp;'&lt;/U&gt;;

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did not find any difference when I delete the blanks between two '&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 02:47:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540634#M149174</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-06T02:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: remove the 'THE' from the 'variable' which end in 'THE' and start with 'THE'.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540636#M149175</link>
      <description>&lt;P&gt;I was sure that using 3 blanks would work.&amp;nbsp; I wasn't sure what would happen if I switched to 1 (or none), so used what I knew would work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are probably many characters that you might want to remove, that your original specifications didn't cover.&amp;nbsp; What would happen, for example, if you had THE plus 2 blanks at the beginning of a line?&amp;nbsp; What if any of these characters were the 5th character in the line, following "THE "?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* (as you mentioned)&lt;/P&gt;
&lt;P&gt;-&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;$&lt;/P&gt;
&lt;P&gt;%&lt;/P&gt;
&lt;P&gt;#&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you should run this program after cleaning up the "THE" occurrences:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=have;&lt;/P&gt;
&lt;P&gt;tables HRM_L2_Step3;&lt;/P&gt;
&lt;P&gt;format HRM_L2_Step3 $1.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That will show you how many times each possible first character actually appears in the entries that remain.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 03:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-the-THE-from-the-variable-which-end-in-THE-and-start-with/m-p/540636#M149175</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-06T03:25:37Z</dc:date>
    </item>
  </channel>
</rss>

