<?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: Replace a string value with previous string in a group  if first 10 characters are same in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-string-value-with-previous-string-in-a-group-if-first/m-p/404747#M98376</link>
    <description>hi .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;DATA NEW_HAVE1 (DROP=merchant_name RENAME=(PREV_VALUE=NEW_VALUE));&lt;BR /&gt;SET HAVE;&lt;BR /&gt;LENGTH PREV_VALUE $50;&lt;BR /&gt;RETAIN PREV_VALUE;&lt;BR /&gt;IF merchant_name =: SUBSTR(PREV_VALUE,1,10) THEN merchant_name=PREV_VALUE;&lt;BR /&gt;ELSE PREV_VALUE=merchant_name;&lt;BR /&gt;RUN;</description>
    <pubDate>Tue, 17 Oct 2017 11:14:33 GMT</pubDate>
    <dc:creator>singhsahab</dc:creator>
    <dc:date>2017-10-17T11:14:33Z</dc:date>
    <item>
      <title>Replace a string value with previous string in a group  if first 10 characters are same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-string-value-with-previous-string-in-a-group-if-first/m-p/404369#M98292</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data which have merchant names but mispelled texts. which is becoming hard while joining this table with&amp;nbsp;other table on basis of merchant name. im trying to replace the text with first row in the group. if first 10 characters are same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Have;
input merchant_name $20.;
cards;
future retail pvt. ltd.
future retail limited
future retail ltd
osborne corporation
osborne corp ltd
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;desired output should be like&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;future retail pvt. ltd.
future retail pvt. ltd.
future retail pvt. ltd.
osborne corporation
osborne corporation&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 04:57:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-string-value-with-previous-string-in-a-group-if-first/m-p/404369#M98292</guid>
      <dc:creator>mohammedali0</dc:creator>
      <dc:date>2017-10-16T04:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a string value with previous string in a group  if first 10 characters are same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-string-value-with-previous-string-in-a-group-if-first/m-p/404370#M98293</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
input MERCHANT_NAME $40.;
cards;
future retail pvt. ltd.
future retail limited
future retail ltd
osborne corporation
osborne corp ltd
run;
data WANT;
  set HAVE;
  length PREV $40;
  retain PREV;
  if MERCHANT_NAME =: substr(PREV,1,10) then MERCHANT_NAME=PREV;
  else PREV=MERCHANT_NAME;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l header" scope="col"&gt;MERCHANT_NAME&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;future retail pvt. ltd.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;future retail pvt. ltd.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;future retail pvt. ltd.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;osborne corporation&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;osborne corporation&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 16 Oct 2017 05:11:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-string-value-with-previous-string-in-a-group-if-first/m-p/404370#M98293</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-10-16T05:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a string value with previous string in a group  if first 10 characters are same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-string-value-with-previous-string-in-a-group-if-first/m-p/404376#M98294</link>
      <description>&lt;P&gt;Thanks a ton Sir.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 06:38:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-string-value-with-previous-string-in-a-group-if-first/m-p/404376#M98294</guid>
      <dc:creator>mohammedali0</dc:creator>
      <dc:date>2017-10-16T06:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a string value with previous string in a group  if first 10 characters are same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-string-value-with-previous-string-in-a-group-if-first/m-p/404747#M98376</link>
      <description>hi .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;DATA NEW_HAVE1 (DROP=merchant_name RENAME=(PREV_VALUE=NEW_VALUE));&lt;BR /&gt;SET HAVE;&lt;BR /&gt;LENGTH PREV_VALUE $50;&lt;BR /&gt;RETAIN PREV_VALUE;&lt;BR /&gt;IF merchant_name =: SUBSTR(PREV_VALUE,1,10) THEN merchant_name=PREV_VALUE;&lt;BR /&gt;ELSE PREV_VALUE=merchant_name;&lt;BR /&gt;RUN;</description>
      <pubDate>Tue, 17 Oct 2017 11:14:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-string-value-with-previous-string-in-a-group-if-first/m-p/404747#M98376</guid>
      <dc:creator>singhsahab</dc:creator>
      <dc:date>2017-10-17T11:14:33Z</dc:date>
    </item>
  </channel>
</rss>

