<?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: Create Variable Based on String searched for in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600753#M173707</link>
    <description>&lt;P&gt;Aha.&amp;nbsp; Didn't notice that.&amp;nbsp; Then your best bet is probably the solution offered by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76464"&gt;@s_lassen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2019 17:39:03 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2019-10-31T17:39:03Z</dc:date>
    <item>
      <title>Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600579#M173637</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like some help to add a new variable based on what I search for. the code I have does not do that. I used the scan function but it will only return based on the position of the word.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what my output gives me&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;name&amp;nbsp;avg_amt&amp;nbsp;home_name&lt;BR /&gt;D.R. Horton INC&amp;nbsp;250&amp;nbsp;D&lt;BR /&gt;Lennar Corp. LLC&amp;nbsp;280&amp;nbsp;Lennar&lt;BR /&gt;PulteGroup INC&amp;nbsp;300&amp;nbsp;PulteGroup&lt;BR /&gt;Meritage Homes LLC&amp;nbsp;320&amp;nbsp;Meritage&lt;BR /&gt;Century Communities LLC&amp;nbsp;500&amp;nbsp;Century&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;M.D.C. Holdings&amp;nbsp; LLC&amp;nbsp;369&amp;nbsp;M&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;&lt;FONT style="background-color: #ffffff;"&gt;But this is what I want&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;name&amp;nbsp;avg_amt&amp;nbsp;home_name&lt;BR /&gt;D.R. Horton INC&amp;nbsp;250&amp;nbsp;D.R. HORTON&lt;BR /&gt;Lennar Corp. LLC&amp;nbsp;280&amp;nbsp;LENNAR&lt;BR /&gt;PulteGroup INC&amp;nbsp;300 PULTE&lt;BR /&gt;Meritage Homes LLC&amp;nbsp;320 MERITAGE HOMES&lt;BR /&gt;Century Communities LLC&amp;nbsp;500 CENTURY&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;M.D.C. Holdings&amp;nbsp; LLC&amp;nbsp;369&amp;nbsp;M.D.C HOLDINGS&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;Here is my code:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&lt;FONT style="background-color: #ffffff;"&gt;&lt;BR /&gt;data homes;&lt;BR /&gt;length name $30;&lt;BR /&gt;infile datalines dlm=",";&lt;BR /&gt;input name $ avg_amt;&lt;BR /&gt;datalines;&lt;BR /&gt;D.R. Horton INC,&amp;nbsp; 250&lt;BR /&gt;Lennar Corp. LLC , 280&lt;BR /&gt;PulteGroup INC,&amp;nbsp; 300&lt;BR /&gt;NVR INC , 258&lt;BR /&gt;KB Home LLC ,987&lt;BR /&gt;Taylor Morrison&amp;nbsp; INC,350&lt;BR /&gt;Meritage Homes LLC,320&lt;BR /&gt;Toll Brothers LLC , 200&lt;BR /&gt;Century Communities LLC, 500&lt;BR /&gt;LGI Homes INC ,253&lt;BR /&gt;M.D.C. Holdings&amp;nbsp; LLC,369&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT style="background-color: #ffffff;"&gt;data want;&lt;BR /&gt;set homes;&lt;BR /&gt;home_name = scan(name,1);&lt;BR /&gt;if prxmatch("m/D.R. HORTON|MERITAGE HOMES|LENNAR|CENTURY|M.D.C. HOLDINGS|PULTE/oi",name) ;&lt;BR /&gt;run;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Any help I can get will be appreciated.&lt;/DIV&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>Wed, 30 Oct 2019 22:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600579#M173637</guid>
      <dc:creator>NewSASPerson</dc:creator>
      <dc:date>2019-10-30T22:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600608#M173653</link>
      <description>&lt;P&gt;Instead of the PRXMATCH function, you will probably be better off with the &lt;STRONG&gt;=:&lt;/STRONG&gt; &amp;nbsp; and/or the &lt;STRONG&gt;in:&lt;/STRONG&gt; operator, which will allow you to compare two character values in a special way.&amp;nbsp; Namely it determines whether all the characters of the shorter value match the leading characters of the longer value, as in ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data homes;
  length name $30;
  infile datalines dlm=",";
  input name $ avg_amt;
datalines;
D.R. Horton INC,  250
Lennar Corp. LLC , 280
PulteGroup INC,  300
NVR INC , 258
KB Home LLC ,987
Taylor Morrison  INC,350
Meritage Homes LLC,320
Toll Brothers LLC , 200
Century Communities LLC, 500
LGI Homes INC ,253
M.D.C. Holdings  LLC,369
;


data want;
  set homes;
  home_name=upcase(name);
  if home_name in: ('D.R. HORTON','MERITAGE HOMES','LENNAR','CENTURY','M.D.C. HOLDINGS','PULTE');
  home_name=tranwrd(home_name,scan(home_name,-1),' ');
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The subsetting IF above uses the &lt;STRONG&gt;IN:&lt;/STRONG&gt; operator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You also seem to want to remove the last word of the resulting name.&amp;nbsp; You can do this by translating the value of the last word (extracted by the SCAN(home_name,-1) function to a blank. &amp;nbsp; The works fine as long as you don't have an earlier word in home_name that is identical to the last word.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 01:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600608#M173653</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-10-31T01:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600615#M173656</link>
      <description>&lt;P&gt;this does not give me just the text searched for. The values for Lennar, Pulte &amp;amp; Century are not correct. I need the field to be the exact string searched for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;name&amp;nbsp;avg_amt&amp;nbsp;home_name&lt;BR /&gt;D.R. Horton INC&amp;nbsp;250&amp;nbsp;D.R. HORTON&lt;BR /&gt;Lennar Corp. LLC&amp;nbsp;280&amp;nbsp;LENNAR CORP.&lt;BR /&gt;PulteGroup INC&amp;nbsp;300&amp;nbsp;PULTEGROUP&lt;BR /&gt;Meritage Homes LLC&amp;nbsp;320&amp;nbsp;MERITAGE HOMES&lt;BR /&gt;Century Communities LLC&amp;nbsp;500&amp;nbsp;CENTURY COMMUNITIES&lt;BR /&gt;M.D.C. Holdings&amp;nbsp; LLC&amp;nbsp;369&amp;nbsp;M.D.C. HOLDINGS&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 03:03:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600615#M173656</guid>
      <dc:creator>NewSASPerson</dc:creator>
      <dc:date>2019-10-31T03:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600617#M173657</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/29035"&gt;@NewSASPerson&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;this does not give me just the text searched for. The values for Lennar, Pulte &amp;amp; Century are not correct. I need the field to be the exact string searched for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: rgb(255, 255, 255);"&gt;name&amp;nbsp;avg_amt&amp;nbsp;home_name&lt;BR /&gt;D.R. Horton INC&amp;nbsp;250&amp;nbsp;D.R. HORTON&lt;BR /&gt;Lennar Corp. LLC&amp;nbsp;280&amp;nbsp;LENNAR CORP.&lt;BR /&gt;PulteGroup INC&amp;nbsp;300&amp;nbsp;PULTEGROUP&lt;BR /&gt;Meritage Homes LLC&amp;nbsp;320&amp;nbsp;MERITAGE HOMES&lt;BR /&gt;Century Communities LLC&amp;nbsp;500&amp;nbsp;CENTURY COMMUNITIES&lt;BR /&gt;M.D.C. Holdings&amp;nbsp; LLC&amp;nbsp;369&amp;nbsp;M.D.C. HOLDINGS&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The program I supplied generates a data set the looks, to me,&amp;nbsp;exactly like what you show above.&amp;nbsp; Here is the proc print result:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;      Obs    name                       avg_amt    home_name
         1     D.R. Horton INC              250      D.R. HORTON
         2     Lennar Corp. LLC             280      LENNAR CORP.
         3     PulteGroup INC               300      PULTEGROUP
         4     Meritage Homes LLC           320      MERITAGE HOMES
         5     Century Communities LLC      500      CENTURY COMMUNITIES
         6     M.D.C. Holdings  LLC         369      M.D.C. HOLDINGS&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you don't get the above, please provide your SAS log, and the&amp;nbsp;unexpected data that you got.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 03:23:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600617#M173657</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-10-31T03:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600654#M173671</link>
      <description>&lt;P&gt;Yes that's what I get with your code. However for Home_Name it needs to say LENNAR but yours says LENNAR CORP. &amp;amp; PULTE but yours says PULTEGROUP&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that helps clarify the need.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 09:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600654#M173671</guid>
      <dc:creator>NewSASPerson</dc:creator>
      <dc:date>2019-10-31T09:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600667#M173675</link>
      <description>&lt;P&gt;It is somewhat variable what parts of a name you need. I would suggest using a lookup table and SQL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data lookup;
  infile datalines dlm=',';
  length lookup_str home_name $30;
  input lookup_str home_name;
cards;
D.R. HORTON %,D.R. HORTON
LENNAR %,LENNAR
PULTE%,PULTE
MERITAGE HOMES %,MERITAGE HOMES
CENTURY %,CENTURY
M.D.C HOLDINGS %,M.D.C HOLDINGS
;run;

proc sql;
  create table want as select homes.*,lookup.home_name
  from homes join lookup on upcase(homes.name) like trim(lookup.lookup_str);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You may have to check against your actual data and design your lookup strings carefully, but there is a chance that this will work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 12:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600667#M173675</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2019-10-31T12:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600753#M173707</link>
      <description>&lt;P&gt;Aha.&amp;nbsp; Didn't notice that.&amp;nbsp; Then your best bet is probably the solution offered by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76464"&gt;@s_lassen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 17:39:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600753#M173707</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-10-31T17:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600871#M173753</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set homes;
if prxmatch("m/D.R. HORTON|MERITAGE HOMES|LENNAR|CENTURY|M.D.C. HOLDINGS|PULTE/oi",name) then
 name2= prxchange("s/(D.R. HORTON|MERITAGE HOMES|LENNAR|CENTURY|M.D.C. HOLDINGS|PULTE)(.*)/\U\1/oi",1,trim(name)) ;
run;&lt;/CODE&gt;&lt;/PRE&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>Fri, 01 Nov 2019 00:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600871#M173753</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-11-01T00:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600933#M173773</link>
      <description>&lt;P&gt;Thank you this worked! However I am curious. What if I want to change&amp;nbsp; CENTURY to BROTHERS what would I need to change in the prxchange function? THE code below gives me "Toll BROTHERS" instead of BROTHERS for name2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token procnames" style="box-sizing: inherit; color: navy; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt; want&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="token keyword" style="background-attachment: scroll; background-clip: border-box; background-color: #ffffff; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; box-sizing: inherit; color: blue; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt; homes&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="token keyword" style="background-attachment: scroll; background-clip: border-box; background-color: #ffffff; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; box-sizing: inherit; color: blue; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token function" style="box-sizing: inherit; color: blue; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;prxmatch&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string" style="box-sizing: inherit; color: maroon; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;"m/D.R. HORTON|MERITAGE HOMES|LENNAR|BROTHERS|M.D.C. HOLDINGS|PULTE/oi"&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt;name&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword" style="background-attachment: scroll; background-clip: border-box; background-color: #ffffff; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; box-sizing: inherit; color: blue; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt;&lt;BR /&gt;name2&lt;/SPAN&gt;&lt;SPAN class="token operator" style="box-sizing: inherit; color: #a67f59; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function" style="box-sizing: inherit; color: blue; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;prxchange&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string" style="box-sizing: inherit; color: maroon; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;"s/(D.R. HORTON|MERITAGE HOMES|LENNAR|BROTHERS|M.D.C. HOLDINGS|PULTE)(.*)/\U\1/oi"&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number" style="box-sizing: inherit; color: #008080; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token function" style="box-sizing: inherit; color: blue; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;trim&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt;name&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="token procnames" style="box-sizing: inherit; color: navy; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="box-sizing: inherit; color: #999999; font-family: Consolas,Monaco,&amp;amp;quot; andale mono&amp;amp;quot;,&amp;amp;quot;ubuntu mono&amp;amp;quot;,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2019 11:43:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/600933#M173773</guid>
      <dc:creator>NewSASPerson</dc:creator>
      <dc:date>2019-11-01T11:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/601114#M173829</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;THE code below gives me "Toll BROTHERS" i&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;It should not. Please provide the data sample and code (one 5-line data step).&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2019 23:11:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/601114#M173829</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-11-01T23:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/601124#M173832</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/29035"&gt;@NewSASPerson&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you this worked! However I am curious. What if I want to change&amp;nbsp; CENTURY to BROTHERS what would I need to change in the prxchange function? THE code below gives me "Toll BROTHERS" instead of BROTHERS for name2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;May be code maintenance becomes easier for you if you use an Informat with the &lt;EM&gt;regexpe&lt;/EM&gt; option and define each search pattern separately. This should allow you to add, amend, remove and test individual rules separately without having to change already working patterns.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  invalue $name2prx(default=30 notsorted upcase)
    's/(D.R. HORTON).*/\U\1/o' (regexpe) = _same_ 
    's/(MERITAGE HOMES).*/\U\1/o' (regexpe) = _same_ 
    's/(LENNAR).*/\U\1/o' (regexpe) = _same_ 
    's/(CENTURY).*/\U\1/o' (regexpe) = _same_ 
    's/(M\.D\.C\. HOLDINGS).*/\U\1/o' (regexpe) = _same_ 
    's/(PULTE).*/\U\1/o' (regexpe) = _same_ 
    's/.*(BROTHERS).*/\U\1/o' (regexpe) = _same_ 
    's/(.*)(\bLLC\b|\bINC\b)$/\U\1/o' (regexpe) = _same_ 
    ; 
run;

data homes;
  length name $30;
  infile datalines dlm=",";
  input name $ avg_amt;
  name2=input(trim(name),$name2prx.);
datalines;
D.R. Horton INC,  250
Lennar Corp. LLC , 280
PulteGroup INC,  300
NVR INC , 258
KB Home LLC ,987
Taylor Morrison  INC,350
Meritage Homes LLC,320
Toll Brothers LLC , 200
Century Communities LLC, 500
LGI Homes INC ,253
M.D.C. Holdings  LLC,369
Toll BROTHERS,111
;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&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;N.B: Normally with informats you can't have overlapping ranges. With RegEx search pattern things are slightly different. You can't use the exact same search pattern twice in the informat but it's possible to formulate more than one search pattern which would match a specific source string.&lt;/P&gt;
&lt;P&gt;Using the informat notsorted option SAS will use the first pattern in the informat that matches. If you want to this allows you to formulate very specific search pattern in the beginning of the informat definition and more generic ones for the "left overs". I've added such a "generic" pattern at the end of the informat. It matches source string&amp;nbsp;&lt;EM&gt;KB Home LLC&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And building on above: It's may be even simpler if you just use normal strings (not patterns) for special cases and then only use RegEx for the remainder. This should also perform better because RegEx operations are costly.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  invalue $name2prx(default=30 upcase notsorted)
    's/(.*)((\bCORP\.) \bLLC\b)$/\U\1/o' (regexpe) = _same_ 
    's/(.*)(LLC\b|\bINC\b)$/\U\1/o' (regexpe) = _same_ 
    ; 
  invalue $name2align(default=30 upcase)
    'PULTEGROUP INC'  = 'PULTE'
    'TOLL BROTHERS' ='BROTHERS'
    'CENTURY COMMUNITIES LLC'='CENTURY'
    other=[$name2prx.]
    ;
run;

data homes;
  length name $30;
  infile datalines dlm=",";
  input name $ avg_amt;
  name2=input(strip(name),$name2align.);
datalines;
D.R. Horton INC,  250
Lennar Corp. LLC , 280
PulteGroup INC,  300
NVR INC , 258
KB Home LLC ,987
Taylor Morrison  INC,350
Meritage Homes LLC,320
Toll Brothers LLC , 200
Century Communities LLC, 500
LGI Homes Inc ,253
M.D.C. Holdings  LLC,369
Toll BROTHERS,111
Case not covered yet Ltd.,111
;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 484px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33596i75BC489B9E07A89E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just out of curiosity:&lt;/P&gt;
&lt;P&gt;How many distinct name strings do you have to clean-up? And is this a one-off process or something you need to repeat when new data arrives?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Nov 2019 04:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/601124#M173832</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-11-02T04:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/605058#M175503</link>
      <description>&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data homes;
length name $30;
infile datalines dlm=",";
input name $ avg_amt;
datalines;
D.R. Horton INC,  250
Lennar Corp. LLC , 280
PulteGroup INC,  300
NVR INC , 258
KB Home LLC ,987
Taylor Morrison  INC,350
Meritage Homes LLC,320
Toll Brothers LLC , 200
Century Communities LLC, 500
LGI Homes INC ,253
M.D.C. Holdings  LLC,369
;
run;

data want;
set homes;
if prxmatch("m/D.R. HORTON|MERITAGE HOMES|LENNAR|CENTURY|BROTHERS|M.D.C. HOLDINGS|PULTE/oi",name) then
 name2= prxchange("s/(D.R. HORTON|MERITAGE HOMES|LENNAR|CENTURY|BROTHERS|M.D.C. HOLDINGS|PULTE)(.*)/\U\1/oi",1,trim(name)) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;These are the results below. "Toll" shows up instead of just BROTHERS&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name			avg_amt	name2
D.R. Horton INC		250	D.R. HORTON
Lennar Corp. LLC	280	LENNAR
PulteGroup INC		300	PULTE
NVR INC			258	
KB Home LLC		987	
Taylor Morrison  INC	350	
Meritage Homes LLC	320	MERITAGE HOMES
Toll Brothers LLC	200	Toll BROTHERS
Century Communities LLC	500	CENTURY
LGI Homes INC		253	
M.D.C. Holdings  LLC	369	M.D.C. HOLDINGS&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 18 Nov 2019 15:44:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/605058#M175503</guid>
      <dc:creator>NewSASPerson</dc:creator>
      <dc:date>2019-11-18T15:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/605059#M175504</link>
      <description>&lt;P&gt;I like this as well, However, I have over 100 distinct strings. using an informat might be time consuming. using prxchange, I am writing the string values into a macro. thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 15:47:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/605059#M175504</guid>
      <dc:creator>NewSASPerson</dc:creator>
      <dc:date>2019-11-18T15:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Based on String searched for</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/605148#M175555</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/29035"&gt;@NewSASPerson&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I like this as well, However, I have over 100 distinct strings. using an informat might be time consuming. using prxchange, I am writing the string values into a macro. thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You do realize that one of the informats uses Regular Expressions and does the same than what you can do with prxchange().&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro nesting then allows for a combination of RegEx and normal string replacement thus allowing you to not need a regular expression for special cases.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 18:38:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Variable-Based-on-String-searched-for/m-p/605148#M175555</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-11-18T18:38:00Z</dc:date>
    </item>
  </channel>
</rss>

