<?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: Adding space between a number and a letter in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584060#M14100</link>
    <description>&lt;P&gt;So did you try that regular expression with the SAS functions that process regular expressions?&lt;/P&gt;</description>
    <pubDate>Mon, 26 Aug 2019 20:27:47 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-08-26T20:27:47Z</dc:date>
    <item>
      <title>Adding space between a number and a letter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584058#M14098</link>
      <description>&lt;P&gt;Hi everyone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to separate character an numbers from a string variable.&lt;/P&gt;&lt;P&gt;For example, I have the string 'CL42N69A30' and I want to create a new variable equal to 'CL 42 N 69 A 30'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In oracle the function "regexp_replace('CL42N69A30', '([[:digit:]]+)([[:alpha:]]+)', '\1 \2')" returns the string "CL42 N69 A30", when I combined&amp;nbsp; "([[:digit:]]+)([[:alpha:]]+)" with&amp;nbsp;"([[:alpha:]]+)([[:digit:]]+)" I have the string that I wanted "CL 42 N 69 A 30".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on how to do this?&lt;/P&gt;&lt;P&gt;Thank you everybody&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584058#M14098</guid>
      <dc:creator>elmendamian</dc:creator>
      <dc:date>2019-08-26T20:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between a number and a letter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584060#M14100</link>
      <description>&lt;P&gt;So did you try that regular expression with the SAS functions that process regular expressions?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584060#M14100</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-26T20:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between a number and a letter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584062#M14101</link>
      <description>&lt;P&gt;Hi Tom, thank's for answer me.&lt;/P&gt;&lt;P&gt;I tried whit the function PRXCHANGE, but the results that not that I wanted.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584062#M14101</guid>
      <dc:creator>elmendamian</dc:creator>
      <dc:date>2019-08-26T20:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between a number and a letter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584063#M14102</link>
      <description>&lt;P&gt;You should look at the SAS regular expression functions PRXChange or Call PRXChange&amp;nbsp;and&amp;nbsp; possibly PRXparse&lt;/P&gt;
&lt;P&gt;A major difference besides the name of the function is that the SAS function places the variable to parse after the instructions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: If you start inserting blanks into an existing SAS variable you may exceed the currently defined length of variable resulting in truncation.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:32:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584063#M14102</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-26T20:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between a number and a letter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584065#M14103</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286694"&gt;@elmendamian&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Tom, thank's for answer me.&lt;/P&gt;
&lt;P&gt;I tried whit the function PRXCHANGE, but the results that not that I wanted.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please post that code and then someone (I'm allergic to regex) can help ensure you've specified the code correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Figuring out the pattern is usually the hardest part anyways.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:36:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584065#M14103</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-26T20:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between a number and a letter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584067#M14104</link>
      <description>&lt;P&gt;Hi Reeza, thank you for answer me.&lt;/P&gt;&lt;P&gt;This is the SAS code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data separa;&lt;BR /&gt;texto = "CL42N69A30";&lt;BR /&gt;separa = PRXCHANGE('s/(\d)/$1 /', -1, texto);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:39:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584067#M14104</guid>
      <dc:creator>elmendamian</dc:creator>
      <dc:date>2019-08-26T20:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between a number and a letter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584068#M14105</link>
      <description>&lt;P&gt;So that does what you asked it to do, it places a space after every digit.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that regex doesn't look anything like the example in your original question.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;452  data separa;
453  texto = "CL42N69A30";
454  separa = PRXCHANGE('s/(\d)/$1 /', -1, texto);
455  put (_all_) (=);
456  run;

texto=CL42N69A30 separa=CL4 2 N6 9 A3 0
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I suspect that&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;[:alpha:]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;has a different meaning in the SAS's regular expression than in your other system.&amp;nbsp; Try telling to search for non digits instead.&lt;/P&gt;
&lt;PRE&gt;492  data separa;
493  texto = "CL42N69A30";
494  separa = PRXCHANGE('s/([^[:digit:]]+)/$1 /', -1,PRXCHANGE('s/([[:digit:]]+)/$1 /', -1,
494! texto));
495  put (_all_) (=);
496  run;

texto=CL42N69A30 separa=CL 42 N 69 A 30
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584068#M14105</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-26T20:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between a number and a letter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584070#M14106</link>
      <description>&lt;P&gt;Yes Tom, the parameter '\d' insert a space between number, and the parameter '\u' insert a space every character of the string.&lt;/P&gt;&lt;P&gt;I need to insert a space between number and letter but I don't know how.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584070#M14106</guid>
      <dc:creator>elmendamian</dc:creator>
      <dc:date>2019-08-26T20:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between a number and a letter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584071#M14107</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286694"&gt;@elmendamian&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes Tom, the parameter '\d' insert a space between number, and the parameter '\u' insert a space every character of the string.&lt;/P&gt;
&lt;P&gt;I need to insert a space between number and letter but I don't know how.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;Then how did you know how to generate the other regular expression that you started with in your question?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is probably easier to just put spaces around the digit strings and use LEFT() function to remove any extra space that it might generate if the string starts with digits.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data separa;
  texto = "CL42N69A30";
  separa = left(PRXCHANGE('s/(\d+)/ $1 /', -1, texto));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;497  data separa;
498  texto = "CL42N69A30";
499  separa = left(PRXCHANGE('s/(\d+)/ $1 /', -1, texto));
500  put (_all_) (=);
501  run;

texto=CL42N69A30 separa=CL 42 N 69 A 30
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:57:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584071#M14107</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-26T20:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between a number and a letter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584072#M14108</link>
      <description>&lt;P&gt;AWESOME!!!!&lt;/P&gt;&lt;P&gt;This is that I wanted.&lt;/P&gt;&lt;P&gt;Thank you very much Tom.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 21:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-space-between-a-number-and-a-letter/m-p/584072#M14108</guid>
      <dc:creator>elmendamian</dc:creator>
      <dc:date>2019-08-26T21:04:24Z</dc:date>
    </item>
  </channel>
</rss>

