<?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: Compress specific characters/strings in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compress-specific-characters-strings/m-p/624853#M184113</link>
    <description>&lt;P&gt;You're welcome &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/29035"&gt;@NewSASPerson&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
    <pubDate>Fri, 14 Feb 2020 14:58:49 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-02-14T14:58:49Z</dc:date>
    <item>
      <title>Compress specific characters/strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-specific-characters-strings/m-p/624847#M184109</link>
      <description>&lt;DIV&gt;&lt;FONT style="background-color: #ffffff;"&gt;I would like to compress only items in the parenthesis as well as the parenthesis without affecting any place else. The code below gives me&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT style="background-color: #ffffff;"&gt;The quick brown fox jumps over&amp;nbsp; lazy dogs. The quick brownfox jumps over the lazy dog.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT style="background-color: #ffffff;"&gt;but what I need is &lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT style="background-color: #ffffff;"&gt;The quick brown fox jumps over 23 lazy dogs. The quick brown-fox jumps over the lazy dog.&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
text = "The quick brown fox jumps over 23 lazy dogs.(1-27) The quick brown-fox jumps over the lazy dog.(28)";
run;
 
data want;
set have;
text2 = compress(text,"()-1234567890");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;I would appreciate some help with this.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Thank you.&lt;/DIV&gt;</description>
      <pubDate>Fri, 14 Feb 2020 14:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-specific-characters-strings/m-p/624847#M184109</guid>
      <dc:creator>NewSASPerson</dc:creator>
      <dc:date>2020-02-14T14:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Compress specific characters/strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-specific-characters-strings/m-p/624849#M184110</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/29035"&gt;@NewSASPerson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try to use a pearl regular expression:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set have;
	text2=prxchange('s/\([\d-]+\)//i', -1, text);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This looks for the pattern \([\d-]+\) in the variable 'text' as many times as needed (second argument = -1)&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;\(&lt;/FONT&gt;&lt;FONT color="#00FF00"&gt;[\d-]&lt;/FONT&gt;&lt;FONT color="#FF00FF"&gt;+&lt;/FONT&gt;&lt;FONT color="#800000"&gt;\)&lt;/FONT&gt; = a &lt;FONT color="#0000FF"&gt;parenthesis&lt;/FONT&gt;&amp;nbsp;followed by &lt;FONT color="#FF00FF"&gt;one or more&lt;/FONT&gt; &lt;FONT color="#00FF00"&gt;digits or hyphens&lt;/FONT&gt; followed by a &lt;FONT color="#800000"&gt;parenthesis&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 14:56:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-specific-characters-strings/m-p/624849#M184110</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-14T14:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Compress specific characters/strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-specific-characters-strings/m-p/624852#M184112</link>
      <description>Perfect! Thank you so much this worked.</description>
      <pubDate>Fri, 14 Feb 2020 14:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-specific-characters-strings/m-p/624852#M184112</guid>
      <dc:creator>NewSASPerson</dc:creator>
      <dc:date>2020-02-14T14:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Compress specific characters/strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-specific-characters-strings/m-p/624853#M184113</link>
      <description>&lt;P&gt;You're welcome &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/29035"&gt;@NewSASPerson&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 14:58:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-specific-characters-strings/m-p/624853#M184113</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-14T14:58:49Z</dc:date>
    </item>
  </channel>
</rss>

