<?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: Overwriting or removing within the column? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637958#M189691</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Do you know if SAS's first attempt at RegEx (the no longer documented or supported but still available &lt;A href="https://v8doc.sas.com/sashtml/lgref/z0332193.htm" target="_self"&gt;RX functions&lt;/A&gt;) was using the posix syntax?&lt;/P&gt;</description>
    <pubDate>Mon, 06 Apr 2020 22:55:08 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-04-06T22:55:08Z</dc:date>
    <item>
      <title>Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637769#M189611</link>
      <description>&lt;P&gt;I've learnt about the nodupkey function and it's very useful in removing duplicated observations.&lt;/P&gt;
&lt;P&gt;But, is there any way I could overwrite or remove duplicates within the column?&lt;/P&gt;
&lt;P&gt;I'm unsure if I have phrased my question correctly, so please see the example below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be greatly appreciated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;ORIGINAL&amp;gt;&lt;/P&gt;
&lt;P&gt;ID Pattern&lt;/P&gt;
&lt;P&gt;1 AABCCA -&amp;gt; ABCA&lt;/P&gt;
&lt;P&gt;&amp;nbsp;2 ABBCC -&amp;gt; ABC&lt;/P&gt;
&lt;P&gt;3 ABBBCDC -&amp;gt; ABCDC&lt;/P&gt;
&lt;P&gt;4 DDCBA -&amp;gt; DCBA&lt;/P&gt;
&lt;P&gt;5 CCC -&amp;gt; C&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;WANT&amp;gt;&lt;/P&gt;
&lt;P&gt;ID Pattern&lt;/P&gt;
&lt;P&gt;1 ABCA&lt;/P&gt;
&lt;P&gt;2 ABC&lt;/P&gt;
&lt;P&gt;3 ABCDC&lt;/P&gt;
&lt;P&gt;4 DCBA&lt;/P&gt;
&lt;P&gt;5 C&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 01:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637769#M189611</guid>
      <dc:creator>SAS_AMUH</dc:creator>
      <dc:date>2020-04-06T01:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637774#M189614</link>
      <description>&lt;P&gt;Hard to tell what you mean.&amp;nbsp; It looks like you mean that PATTERN is a character variable that has strings that look like "&lt;SPAN&gt;AABCCA -&amp;gt; ABCA" and you want to just keep the part after the last greater than sign.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have ;
  if index(pattern,'&amp;gt;') then pattern=scan(pattern,-1,'&amp;gt;');
  else do;
/* not sure what you want to do here 
  since all of your examples have the &amp;gt; sign
*/
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Apr 2020 02:30:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637774#M189614</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-06T02:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637776#M189615</link>
      <description>&lt;P&gt;Thank you Tom.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm very sorry, I totally forgot to remove those -&amp;gt; arrow signs.&lt;/P&gt;
&lt;P&gt;They are not in the actual data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;ORIGINAL&amp;gt;&lt;/P&gt;
&lt;P&gt;ID Pattern&lt;/P&gt;
&lt;P&gt;1 AABCCA&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;2 ABBCC&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3 ABBBCDC&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4 DDCBA&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5 CCC&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;WANT&amp;gt;&lt;/P&gt;
&lt;P&gt;ID Pattern&lt;/P&gt;
&lt;P&gt;1 ABCA&lt;/P&gt;
&lt;P&gt;2 ABC&lt;/P&gt;
&lt;P&gt;3 ABCDC&lt;/P&gt;
&lt;P&gt;4 DCBA&lt;/P&gt;
&lt;P&gt;5 C&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 02:38:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637776#M189615</guid>
      <dc:creator>SAS_AMUH</dc:creator>
      <dc:date>2020-04-06T02:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637777#M189616</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  set HAVE;
  PATTERN1=prxchange('s/(.)(?=\1)/\2/',-1,PATTERN);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE class="table" style="border-collapse: collapse; border-spacing: 0px; margin-bottom: 1em; border-width: 1px 0px 0px 1px; border-style: solid; border-color: #c1c1c1; border-image: initial; margin-left: auto; margin-right: auto; color: #000000; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: center; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafbfe; text-decoration-style: initial; text-decoration-color: initial;" aria-label="Data Set WORK.WANT"&gt;&lt;CAPTION aria-label="Data Set WORK.WANT"&gt;&amp;nbsp;&lt;/CAPTION&gt;&lt;COLGROUP&gt;&lt;COL style="border-left: 1px solid #c1c1c1; border-right: 0px solid #c1c1c1;" /&gt;&lt;COL style="border-left: 1px solid #c1c1c1; border-right: 0px solid #c1c1c1;" /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TH class="header" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #edf2f9; border-color: #b0b7bb; border-style: solid; border-width: 0px 1px 1px 0px; color: #112277; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: bold;" scope="col"&gt;PATTERN&lt;/TH&gt;
&lt;TH class="header" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #edf2f9; border-color: #b0b7bb; border-style: solid; border-width: 0px 1px 1px 0px; color: #112277; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: bold;" scope="col"&gt;PATTERN1&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;AABCCA&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;ABCA&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;ABBCC&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;ABC&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;ABBBCDC&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;ABCDC&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;DDCBA&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;DCBA&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;CCC&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 06 Apr 2020 02:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637777#M189616</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-06T02:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637795#M189621</link>
      <description>&lt;P&gt;Thank you so much.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would really appreciate it if you could please briefly tell me what each coding means.&lt;/P&gt;
&lt;P&gt;I need to modify it to suit to my other similar data and I'd like to learn about this coding.&lt;/P&gt;
&lt;P&gt;However, my SAS level is limited and I don't know what keywords I could use to look up in a help site like this or the guide books.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 07:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637795#M189621</guid>
      <dc:creator>SAS_AMUH</dc:creator>
      <dc:date>2020-04-06T07:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637815#M189632</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Pattern $;
cards;
1 AABCCA 
2 ABBCC 
3 ABBBCDC 
4 DDCBA 
5 CCC 
;
data want;
 set have;
 want=prxchange('s/(\w)\1+/\1/',-1,Pattern);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Apr 2020 10:46:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637815#M189632</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-04-06T10:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637817#M189634</link>
      <description>&lt;P&gt;This syntax (and the syntax in &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; 's answer) uses regular expressions. It is not special to SAS. In fact it started with the PERL language if I am not mistaken.&lt;/P&gt;
&lt;P&gt;There are many tutorials on the web. That's how I learnt.&lt;/P&gt;
&lt;P&gt;I'll detail&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; 's expression as I prefer it to mine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;s          enter substitution mode
/          start of matching expression
(\w)       \w means: match any word character, brackets mean: capture the match 
\1+        \1 means: match the previous capture group, + means: at least once
/          end of matching expression, start of replacing expression
\1         replace with first capture group
/          end of expression&lt;/LI-CODE&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;
&lt;P&gt;So we match one character (and capture it) and match more of the same character.&lt;/P&gt;
&lt;P&gt;If this was found, we replace with the matched character.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 23:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637817#M189634</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-06T23:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637838#M189645</link>
      <description>&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/Regular_expression" target="_blank" rel="noopener"&gt;Regular Expressions&lt;/A&gt; have been invented in the 1950's and are at the core of the UNIX operating system. Perl just uses its own syntax, different from the POSIX syntax used in UNIX.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 13:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637838#M189645</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-06T13:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637958#M189691</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Do you know if SAS's first attempt at RegEx (the no longer documented or supported but still available &lt;A href="https://v8doc.sas.com/sashtml/lgref/z0332193.htm" target="_self"&gt;RX functions&lt;/A&gt;) was using the posix syntax?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 22:55:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/637958#M189691</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-06T22:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/638006#M189714</link>
      <description>&lt;P&gt;Well, I found this:&amp;nbsp;&lt;A href="https://v8doc.sas.com/sashtml/lgref/z0331192.htm" target="_blank" rel="noopener"&gt;https://v8doc.sas.com/sashtml/lgref/z0331192.htm&lt;/A&gt;, and the patterns used there look not like what I am used to from UNIX shell scripting.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 08:59:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/638006#M189714</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-07T08:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting or removing within the column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/638023#M189725</link>
      <description>&lt;P&gt;Mmm interesting . Who knows where they got the SAS patterns from....&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 11:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Overwriting-or-removing-within-the-column/m-p/638023#M189725</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-07T11:33:59Z</dc:date>
    </item>
  </channel>
</rss>

