<?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: How do I Data manipulate of remove special char and shift string in to next row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651545#M195492</link>
    <description>&lt;P&gt;With regular expressions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
if not prxId then prxId + prxParse("/\w+/");
set have;
start = 1; stop = length(type);
call prxnext(prxID, start, stop, type, position, length);
  do while (position &amp;gt; 0);
     newType = substr(type, position, length);
     output;
     call prxnext(prxID, start, stop, type, position, length);
  end;
drop prxId start stop position length;
rename newType=type;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 28 May 2020 20:28:51 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-05-28T20:28:51Z</dc:date>
    <item>
      <title>How do I Data manipulate of remove special char and shift string in to next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651519#M195485</link>
      <description>&lt;P&gt;I have input data set : have.&lt;/P&gt;&lt;P&gt;I want to remove special char from Type Variable and if There are two type in One row, then second type should be shift to next row associated with Same ID.&lt;BR /&gt;Looking for below output in want dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID Type&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; T&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; KO&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; W&lt;BR /&gt;3&amp;nbsp; &amp;nbsp; 3&lt;BR /&gt;3&amp;nbsp; &amp;nbsp; K3&lt;BR /&gt;4&amp;nbsp; &amp;nbsp; R&lt;BR /&gt;5&amp;nbsp; &amp;nbsp; LBL&lt;BR /&gt;6&amp;nbsp; &amp;nbsp; LBL&lt;BR /&gt;7&amp;nbsp; &amp;nbsp; G&lt;BR /&gt;8&amp;nbsp; &amp;nbsp; S&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data have ;
infile datalines dlm=' ' dsd;
Input ID $ type $;
datalines;
1 ^T
2 ^KO|^W
3 ^3|K3
4 ^R
5 ^LBL
6 ^LBL
7 ^G
8 ^S
;
run&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 May 2020 19:15:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651519#M195485</guid>
      <dc:creator>Riteshdell</dc:creator>
      <dc:date>2020-05-28T19:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Data manipulate of remove special char and shift string in to next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651528#M195489</link>
      <description>&lt;P&gt;Please try the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
set have;
if scan(type,1,'|') ne '' then type2=scan(compress(type,'^'),1,'|');
output;
if scan(type,2,'|') ne '' then do;
type2=scan(compress(type,'^'),2,'|');
output;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 May 2020 19:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651528#M195489</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-05-28T19:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Data manipulate of remove special char and shift string in to next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651529#M195490</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have ;
infile datalines dlm=' ' dsd;
Input ID $ type $;
datalines;
1 ^T
2 ^KO|^W
3 ^3|K3
4 ^R
5 ^LBL
6 ^LBL
7 ^G
8 ^S
;
run;

data want;
 set have;
 do _n_=1 to countw(type,'|');
  need=compress(scan(type,_n_,'|'),,'cp');
  output;
 end;
 drop type;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 May 2020 19:40:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651529#M195490</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-28T19:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Data manipulate of remove special char and shift string in to next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651532#M195491</link>
      <description>&lt;P&gt;How do we know where one type starts or ends? You really should tell us that you want to split at the | character instead of making us guess.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way:&lt;/P&gt;
&lt;PRE&gt;data have ;
   infile datalines dlm=' ' dsd;
   Input ID $ type $;
   do i= 1 to countw(type,'|');
      newtype = compress(scan(type,i,'|'),'','ADK');
      output;
   end;
   drop i;
datalines;
1 ^T
2 ^KO|^W
3 ^3|K3
4 ^R
5 ^LBL
6 ^LBL
7 ^G
8 ^S
;
run&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 May 2020 19:42:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651532#M195491</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-28T19:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Data manipulate of remove special char and shift string in to next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651545#M195492</link>
      <description>&lt;P&gt;With regular expressions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
if not prxId then prxId + prxParse("/\w+/");
set have;
start = 1; stop = length(type);
call prxnext(prxID, start, stop, type, position, length);
  do while (position &amp;gt; 0);
     newType = substr(type, position, length);
     output;
     call prxnext(prxID, start, stop, type, position, length);
  end;
drop prxId start stop position length;
rename newType=type;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 May 2020 20:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651545#M195492</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-05-28T20:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Data manipulate of remove special char and shift string in to next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651624#M195531</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;- This is the way I was looking for, in regular expression, logic is more dynamic if we get some other special char as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks others as well for trying it and giving your best sol.&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 04:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Data-manipulate-of-remove-special-char-and-shift-string/m-p/651624#M195531</guid>
      <dc:creator>Riteshdell</dc:creator>
      <dc:date>2020-05-29T04:29:55Z</dc:date>
    </item>
  </channel>
</rss>

