<?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 single,double quotes,comma,brackets in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/530284#M5730</link>
    <description>&lt;P&gt;it does work for abc's. try out below code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length have $ 25;
  input have 1 - 25;
  want = compbl(prxchange('s/["'')(,]+/ /',-1, have));
  datalines;
"abc,'abc' (abc) "abc"
(abc) "abc" 'abc' abc,
(abc)(abc)(abc)((abc))
(((abc,)))"abc"'abc'
abc's
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 26 Jan 2019 00:19:04 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2019-01-26T00:19:04Z</dc:date>
    <item>
      <title>compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/523937#M4719</link>
      <description>&lt;P&gt;How to compress single,double quotes,comma,brackets so the text is not completely compressed&lt;/P&gt;&lt;P&gt;I have text that will be as below:&lt;/P&gt;&lt;P&gt;"abc,'abc' (abc) "abc"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so would like to make it to as&lt;/P&gt;&lt;P&gt;abc abc abc abc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Dec 2018 16:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/523937#M4719</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-12-31T16:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/523942#M4720</link>
      <description>&lt;P&gt;You can use TRANSLATE to change the characters to spaces.&amp;nbsp; You can use COMPBL to change multiple spaces to one space.&amp;nbsp; You can use STRIP to remove space at the end.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length have $ 25;
  input have 1 - 25;
  want = strip(
         compbl(
                translate(have,' ','"',
                               ' ',"'",
                               ' ','(',
                               ' ',')',
                               ' ',',')
                )
               );
  length_of_want=length(want);
  datalines;
"abc,'abc' (abc) "abc"
(abc) "abc" 'abc' abc,
(abc)(abc)(abc)((abc))
(((abc,)))"abc"'abc'
  ;
run;

proc print data=test;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Dec 2018 17:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/523942#M4720</guid>
      <dc:creator>SuzanneDorinski</dc:creator>
      <dc:date>2018-12-31T17:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/523945#M4721</link>
      <description>&lt;P&gt;Great answer.&lt;/P&gt;
&lt;P&gt;Note that the TRANSLATE function will take longer strings, so no need to make multiple TO/FROM pairs.&amp;nbsp; Plus it will pad out short TO strings with spaces.&amp;nbsp; Also STRIP() can be simplified to LEFT().&amp;nbsp; When the result is assigned to another variable the value will be padded on the right with spaces anyway.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;want = compbl(left(translate(have,' ','(",'')')));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Dec 2018 17:50:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/523945#M4721</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-12-31T17:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/523951#M4722</link>
      <description>&lt;P&gt;same idea as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12496"&gt;@SuzanneDorinski&lt;/a&gt;. You can also use prxchange&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[ ] --- anything mentioned in square bracket will be replace by space&amp;nbsp;&lt;/P&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;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length have $ 25;
  input have 1 - 25;
  want = compbl(prxchange('s/["'')(,]+/ /',-1, have));
  datalines;
"abc,'abc' (abc) "abc"
(abc) "abc" 'abc' abc,
(abc)(abc)(abc)((abc))
(((abc,)))"abc"'abc'
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Dec 2018 20:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/523951#M4722</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-12-31T20:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/523982#M4729</link>
      <description>&lt;PRE&gt;  want = compress(have, , 'kas');&lt;/PRE&gt;
&lt;P&gt;Use the modifiers,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;K - keeps characters&lt;/P&gt;
&lt;P&gt;a - alphabetic&lt;/P&gt;
&lt;P&gt;s - spaces, tabs etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RTM for more details:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0fcshr0ir3h73n1b845c4aq58hz.htm&amp;amp;locale=en#n1mi06lpn9ak5yn14q584vlzg32v" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0fcshr0ir3h73n1b845c4aq58hz.htm&amp;amp;locale=en#n1mi06lpn9ak5yn14q584vlzg32v&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16600"&gt;@SASPhile&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;How to compress single,double quotes,comma,brackets so the text is not completely compressed&lt;/P&gt;
&lt;P&gt;I have text that will be as below:&lt;/P&gt;
&lt;P&gt;"abc,'abc' (abc) "abc"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so would like to make it to as&lt;/P&gt;
&lt;P&gt;abc abc abc abc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jan 2019 01:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/523982#M4729</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-01T01:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/524018#M4732</link>
      <description>&lt;P&gt;Nice and interesting question to experiment various ideas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
  input have $ 1 - 25;
   length want  $ 25;
  array t(99) $;
  j=countw(compress(have),,'p'); 
  do _n_=1 to j;
  t(_n_)=scan(compress(have),_n_,,'p');
  end;
  want=catx(' ',of t(*));
  drop j t:;
  datalines;
"abc,'abc' (abc) "abc"
(abc) "abc" 'abc' abc,
(abc)(abc)(abc)((abc))
(((abc,)))"abc"'abc'
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Jan 2019 00:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/524018#M4732</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-02T00:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/524019#M4733</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;Happy new year to you and others in the thread/sas communities.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am afraid your&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  want = compress(have, , 'kas');&lt;/PRE&gt;
&lt;P&gt;will not quite meet the delimiter&amp;nbsp; constraints in cases like&amp;nbsp;&lt;STRONG&gt;"abc,'abc'&lt;/STRONG&gt; (abc) "abc"&amp;nbsp; for the reason there is no space in the highligted postion and so compress can't keep space if that doesn't exist. And most likely the same case for the 4th record and beyond. That's perhaps why&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12496"&gt;@SuzanneDorinski&lt;/a&gt;&amp;nbsp;'s strategy of replace and compbl makes sense. My 2 cents&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have great year ahead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 00:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/524019#M4733</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-02T00:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/524023#M4735</link>
      <description>No it won't but the OP asked for a COMPRESS solution and this was the closest I could find. I suspect the original data is JSON or XML and that would be better overall, but that's just a guess.</description>
      <pubDate>Wed, 02 Jan 2019 00:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/524023#M4735</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-02T00:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/524024#M4736</link>
      <description>&lt;P&gt;Ah ok, It's cool. I really like your crispy techniques and do take notes.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 00:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/524024#M4736</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-02T00:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/524026#M4737</link>
      <description>&lt;P&gt;Sets of 3 letters is obviously not real, so just for experimental fun&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
  input have $ 1 - 25;
   length want  $ 25;
  array t(99) $3;
  call pokelong(compress(have,,'ka'),addrlong(t(1)),25); 
  want=catx(' ',of t(*));
  drop t:;
  datalines;
"abc,'abc' (abc) "abc"
(abc) "abc" 'abc' abc,
(abc)(abc)(abc)((abc))
(((abc,)))"abc"'abc'
"abc,'abc' (abc) "abc"
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Jan 2019 00:59:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/524026#M4737</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-02T00:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/530163#M5681</link>
      <description>&lt;P&gt;I try to introduce single quote inside the [] and it leads to unbalanced quotes. how to replace a single quote along with other charcters in the square bracts?&lt;BR /&gt;like abc's&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 19:09:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/530163#M5681</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2019-01-25T19:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/530164#M5682</link>
      <description>I try to introduce single quote inside the [] and it leads to unbalanced quotes. how to replace a single quote along with other charcters in the square bracts?&lt;BR /&gt;like abc's</description>
      <pubDate>Fri, 25 Jan 2019 19:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/530164#M5682</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2019-01-25T19:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: compress single,double quotes,comma,brackets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/530284#M5730</link>
      <description>&lt;P&gt;it does work for abc's. try out below code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length have $ 25;
  input have 1 - 25;
  want = compbl(prxchange('s/["'')(,]+/ /',-1, have));
  datalines;
"abc,'abc' (abc) "abc"
(abc) "abc" 'abc' abc,
(abc)(abc)(abc)((abc))
(((abc,)))"abc"'abc'
abc's
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 26 Jan 2019 00:19:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compress-single-double-quotes-comma-brackets/m-p/530284#M5730</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2019-01-26T00:19:04Z</dc:date>
    </item>
  </channel>
</rss>

