<?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: remove whitespace in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/512026#M2284</link>
    <description>&lt;P&gt;For an increase in speed, try the following which uses lazy repetition factors (i.e. \s*?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;length var1 $ 100&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; var2 $ 100;&lt;BR /&gt;var1=' // / /ab c / d e f /g hij/ //kl m/ / ';&lt;BR /&gt;var2=prxchange('s/\s*?(\/)\s*?(?!\s)/$1/', -1, var1);&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Nov 2018 18:39:37 GMT</pubDate>
    <dc:creator>Shemp</dc:creator>
    <dc:date>2018-11-11T18:39:37Z</dc:date>
    <item>
      <title>remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511861#M2260</link>
      <description>&lt;P&gt;How to remove space before and after slash(/)?&lt;/P&gt;&lt;P&gt;Coming /&amp;nbsp; not coming&amp;nbsp; to be displayed as &lt;STRONG&gt;coming/not coming&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 22:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511861#M2260</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-11-09T22:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511862#M2261</link>
      <description>&lt;P&gt;is this value of a sas variable/macro variable source&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or plain hardcoded text to display in the log?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 22:34:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511862#M2261</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-09T22:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511864#M2262</link>
      <description>&lt;P&gt;You are missing an example relating to your question.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 22:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511864#M2262</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-11-09T22:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511865#M2263</link>
      <description>&lt;P&gt;Will it always have one space on either side or is it variable? Have you tried TRANWRD()?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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 remove space before and after slash(/)?&lt;/P&gt;
&lt;P&gt;Coming /&amp;nbsp; not coming&amp;nbsp; to be displayed as &lt;STRONG&gt;coming/not coming&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 22:42:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511865#M2263</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-09T22:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511878#M2264</link>
      <description>&lt;P&gt;If you have at most one slash per line, this would do it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if index(var, '/') then var = strip(scan(var, 1, '/')) || '/' || strip(scan(var, 2, '/'));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you might have multiple slashes per line, I'd turn the problem over to someone who knows parsing functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 23:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511878#M2264</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-09T23:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511883#M2266</link>
      <description>&lt;P&gt;SAS variable. It can have single or multiple spaces&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 23:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511883#M2266</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-11-09T23:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511888#M2268</link>
      <description>&lt;P&gt;data test;&lt;BR /&gt;length var1 $ 20&lt;BR /&gt;var2 $ 20;&lt;BR /&gt;var1='abc / def / efg';&lt;BR /&gt;var2=prxchange('s/([^\s]*)\s*(\/)\s*([^\s]*)/$1$2$3/', -1, var1);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 00:24:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511888#M2268</guid>
      <dc:creator>Shemp</dc:creator>
      <dc:date>2018-11-10T00:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511908#M2274</link>
      <description>&lt;P&gt;thanks, whar are $1,$2,$3?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 04:28:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511908#M2274</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-11-10T04:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511921#M2277</link>
      <description>&lt;PRE&gt;data _null_;
x='Coming /  not coming  ';
y=prxchange('s/\s+(?=\/)|(?&amp;lt;=\/)\s+//',-1,x);
put x= / y=;
run;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Nov 2018 11:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511921#M2277</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-11-10T11:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511929#M2278</link>
      <description>&lt;P&gt;For what its worth, linear approach using scan and catx seems easy minus efficiency(this is something I am not good at)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The catx safely strips the leading and trailing blanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
str="Coming /  not coming/ will    come/ must  come/ come to party";
run;

data want;
set have;
length want_str $100;
str=compbl(str);
do _n_=1 to countw(str,'/');
temp=scan(str,_n_,'/');
want_str=catx('/',want_str,temp);
end;
drop temp;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Nov 2018 15:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511929#M2278</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-10T15:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511933#M2279</link>
      <description>&lt;P&gt;Or combine &lt;STRONG&gt;novinosrin&lt;/STRONG&gt;'s&amp;nbsp;&lt;FONT face="courier new,courier"&gt;compbl&lt;/FONT&gt; idea with &lt;STRONG&gt;Reeza&lt;/STRONG&gt;'s &lt;SPAN&gt;TRANWRD() suggestion:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
length want_str $100;
want_str=tranwrd(tranwrd(compbl(str),' /','/'),'/ ','/');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Limitation: Removes blanks, but no other white-space characters (such as tabs, 'A0'x etc.).&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 16:19:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511933#M2279</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-11-10T16:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511936#M2280</link>
      <description>&lt;P&gt;Truly another golf and the fastest on Depaul lab machine. Maybe you should show some interest in soccer too as we loop end to end (my favorite sport). I tested for 10 million records&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Surprisingly, both the sas functions approaches are much faster than prx on this machine and I don't know why&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 17:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511936#M2280</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-10T17:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511969#M2281</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Surprisingly, both the sas functions approaches are much faster than prx on this machine and I don't know why&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The regex machinery is very powerful and flexible, but this comes at a price. I don't know the details of their inner workings, but the algorithms &lt;EM&gt;must&lt;/EM&gt; be more complex (hence slower) than those behind functions like COMPBL or TRANWRD which are limited to simpler tasks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interestingly, the PRX approach didn't get any faster when I tested it with a blank in place of the \s metacharacter (using Ksharp's regex), although this should actually simplify the task.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 20:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/511969#M2281</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-11-10T20:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/512025#M2283</link>
      <description>&lt;P&gt;Those are capture buffers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Nov 2018 18:37:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/512025#M2283</guid>
      <dc:creator>Shemp</dc:creator>
      <dc:date>2018-11-11T18:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: remove whitespace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/512026#M2284</link>
      <description>&lt;P&gt;For an increase in speed, try the following which uses lazy repetition factors (i.e. \s*?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;length var1 $ 100&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; var2 $ 100;&lt;BR /&gt;var1=' // / /ab c / d e f /g hij/ //kl m/ / ';&lt;BR /&gt;var2=prxchange('s/\s*?(\/)\s*?(?!\s)/$1/', -1, var1);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Nov 2018 18:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/remove-whitespace/m-p/512026#M2284</guid>
      <dc:creator>Shemp</dc:creator>
      <dc:date>2018-11-11T18:39:37Z</dc:date>
    </item>
  </channel>
</rss>

