<?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: consecutive numbers in to one column, and the rest characters in the other in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778672#M247893</link>
    <description>&lt;P data-unlink="true"&gt;PeterClemmensen,&amp;nbsp;thank you so much!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Nov 2021 08:08:58 GMT</pubDate>
    <dc:creator>J_J_J</dc:creator>
    <dc:date>2021-11-05T08:08:58Z</dc:date>
    <item>
      <title>consecutive numbers in to one column, and the rest characters in the other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778205#M247704</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;I want to put 7 consecutive numbers in to one column, and the rest characters in the other. Please let me know how to do it?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data state;&lt;/P&gt;
&lt;P&gt;input ID $;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;AAAAAA BBB 1111111&lt;BR /&gt;2222222 CCC -1111&lt;BR /&gt;CCCCCCC 2222222&lt;BR /&gt;CCCCCCCCCCC 3333333&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Want:&lt;/P&gt;
&lt;TABLE style="width: 700px;" width="700"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="138.109px"&gt;ID&lt;/TD&gt;
&lt;TD width="73.2969px"&gt;Number&lt;/TD&gt;
&lt;TD width="138.109px"&gt;ABC&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="138.109px"&gt;AAAAAA BBB 1111111&lt;/TD&gt;
&lt;TD width="73.2969px"&gt;1111111&lt;/TD&gt;
&lt;TD width="138.109px"&gt;AAAAAA BBB&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="138.109px"&gt;2222222 CCC -1111&lt;/TD&gt;
&lt;TD width="73.2969px"&gt;2222222&lt;/TD&gt;
&lt;TD width="138.109px"&gt;CCC -1111&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="138.109px"&gt;CCCCCCC 2222222&lt;/TD&gt;
&lt;TD width="73.2969px"&gt;2222222&lt;/TD&gt;
&lt;TD width="138.109px"&gt;CCCCCCC&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="138.109px"&gt;CCCCCCCCCCC 3333333&lt;/TD&gt;
&lt;TD width="73.2969px"&gt;3333333&lt;/TD&gt;
&lt;TD width="138.109px"&gt;CCCCCCCCCCC&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Wed, 03 Nov 2021 14:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778205#M247704</guid>
      <dc:creator>J_J_J</dc:creator>
      <dc:date>2021-11-03T14:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: consecutive numbers in to one column, and the rest characters in the other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778213#M247705</link>
      <description>&lt;P&gt;Suggest strongly that you test code to build data sets before posting it. Your code had no actual values with both the 7 digits and characters.&lt;/P&gt;
&lt;P&gt;Try this one:&lt;/P&gt;
&lt;PRE&gt;data state;
  infile datalines dlm=',';
  input ID :$20.;
cards;
AAAAAA BBB 1111111
2222222 CCC -1111
CCCCCCC 2222222
CCCCCCCCCCC 3333333
;
&lt;/PRE&gt;
&lt;P&gt;The default length when reading data with a simple $ is 8 characters, so couldn't hold the length you desired. Second spaces delimit the values, so only the first set of characters were read. Specifying the DLM=',' means that a comma is needed to delimit values, so all of the string can be read. The :$20. says to use a character informat of upto 20 characters to read (since that is the longest value you show).&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 14:24:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778213#M247705</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-11-03T14:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: consecutive numbers in to one column, and the rest characters in the other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778228#M247709</link>
      <description>&lt;P&gt;Once you have corrected your sample data issues, then you are probably going to want to do something like this, using the &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n0bj9p4401w3n9n1gmv6tf**bleep**9m.htm#p1vrrbbga42an4n1h7gn2buiui6z" target="_self"&gt;PRX functions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create Sample Data */
data state;
  infile datalines dlm=',';
  input ID :$20.;
cards;
AAAAAA BBB 1111111
2222222 CCC -1111
CCCCCCC 2222222
CCCCCCCCCCC 3333333
;

data want ;
	set state ;
	/* create a pattern ID that looks for 7 consecutive numbers */
	patternID=prxparse('/[0-9]{7}/') ;
	/* Search for that pattern */
	position=prxmatch(patternID, id);
	put _n_= position= ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Nov 2021 15:07:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778228#M247709</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2021-11-03T15:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: consecutive numbers in to one column, and the rest characters in the other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778310#M247731</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data state;
input ID $ 1-50;
cards;
AAAAAA BBB 1111111
2222222 CCC -1111
CCCCCCC 2222222
CCCCCCCCCCC 3333333
;

data want;
   set state;
   number = substr(ID, prxmatch('/\d{7}/', ID), 7);
   ABC = prxchange('s/\d{7}//', -1, ID);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID                 number   ABC
AAAA BBB 1111111   1111111  AAAAAA BBB
22222 CCC -1111    2222222  CCC -1111
CCCCC 2222222      2222222  CCCCCCC
CCCCCCCCC 3333333  3333333  CCCCCCCCCCC&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 18:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778310#M247731</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-11-03T18:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: consecutive numbers in to one column, and the rest characters in the other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778672#M247893</link>
      <description>&lt;P data-unlink="true"&gt;PeterClemmensen,&amp;nbsp;thank you so much!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 08:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/consecutive-numbers-in-to-one-column-and-the-rest-characters-in/m-p/778672#M247893</guid>
      <dc:creator>J_J_J</dc:creator>
      <dc:date>2021-11-05T08:08:58Z</dc:date>
    </item>
  </channel>
</rss>

