<?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 insert spaces between characters every third position in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/insert-spaces-between-characters-every-third-position/m-p/449882#M113278</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got a dataset&amp;nbsp;(a) with the following characters:&lt;/P&gt;&lt;P&gt;211221222223215&lt;BR /&gt;133122111&lt;BR /&gt;822823&lt;BR /&gt;811811811823883884&lt;BR /&gt;215&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I now want to create a space between after every third position. So the new dataset (b) would be like:&lt;/P&gt;&lt;P&gt;211 221 222 223 215&lt;BR /&gt;133 122 111&lt;BR /&gt;822 823&lt;BR /&gt;811 811 811 823 883 884&lt;BR /&gt;215&lt;/P&gt;&lt;P&gt;(the actual list is about 5000 observations)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the prxchange function and something with an array, but its not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully you have some ideas wich i can try?&lt;/P&gt;&lt;P&gt;Thanks in advance&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;</description>
    <pubDate>Fri, 30 Mar 2018 11:04:59 GMT</pubDate>
    <dc:creator>Marcellllo</dc:creator>
    <dc:date>2018-03-30T11:04:59Z</dc:date>
    <item>
      <title>insert spaces between characters every third position</title>
      <link>https://communities.sas.com/t5/SAS-Programming/insert-spaces-between-characters-every-third-position/m-p/449882#M113278</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got a dataset&amp;nbsp;(a) with the following characters:&lt;/P&gt;&lt;P&gt;211221222223215&lt;BR /&gt;133122111&lt;BR /&gt;822823&lt;BR /&gt;811811811823883884&lt;BR /&gt;215&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I now want to create a space between after every third position. So the new dataset (b) would be like:&lt;/P&gt;&lt;P&gt;211 221 222 223 215&lt;BR /&gt;133 122 111&lt;BR /&gt;822 823&lt;BR /&gt;811 811 811 823 883 884&lt;BR /&gt;215&lt;/P&gt;&lt;P&gt;(the actual list is about 5000 observations)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the prxchange function and something with an array, but its not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully you have some ideas wich i can try?&lt;/P&gt;&lt;P&gt;Thanks in advance&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;</description>
      <pubDate>Fri, 30 Mar 2018 11:04:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/insert-spaces-between-characters-every-third-position/m-p/449882#M113278</guid>
      <dc:creator>Marcellllo</dc:creator>
      <dc:date>2018-03-30T11:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: insert spaces between characters every third position</title>
      <link>https://communities.sas.com/t5/SAS-Programming/insert-spaces-between-characters-every-third-position/m-p/449883#M113279</link>
      <description>&lt;P&gt;Use a do loop and substr():&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input string :$30.;
cards;
211221222223215
133122111
822823
811811811823883884
215
;
run;

data want (rename=(newstring=string));
set have;
i = 1;
length newstring $30;
do until (i &amp;gt; length(string));
  newstring = catx(' ',newstring,substr(string,i,3));
  i + 3;
end;
drop i string;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Mar 2018 11:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/insert-spaces-between-characters-every-third-position/m-p/449883#M113279</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-30T11:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: insert spaces between characters every third position</title>
      <link>https://communities.sas.com/t5/SAS-Programming/insert-spaces-between-characters-every-third-position/m-p/449884#M113280</link>
      <description>&lt;P&gt;It works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 11:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/insert-spaces-between-characters-every-third-position/m-p/449884#M113280</guid>
      <dc:creator>Marcellllo</dc:creator>
      <dc:date>2018-03-30T11:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: insert spaces between characters every third position</title>
      <link>https://communities.sas.com/t5/SAS-Programming/insert-spaces-between-characters-every-third-position/m-p/449922#M113291</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input string :$30.;
want=prxchange('s/(\d\d\d)/$1 /',-1,string);
cards;
211221222223215
133122111
822823
811811811823883884
215
;
run;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Mar 2018 13:20:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/insert-spaces-between-characters-every-third-position/m-p/449922#M113291</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-30T13:20:57Z</dc:date>
    </item>
  </channel>
</rss>

