<?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: How to extract a specific string please in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-specific-string-please/m-p/567956#M159786</link>
    <description>&lt;P&gt;data work.one;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numchar='30012324431440~~PABC';&lt;BR /&gt;&amp;nbsp;&amp;nbsp; format num best15.;&lt;BR /&gt;&amp;nbsp; num=input(substr(numchar,1,14),14.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; char=substr(numchar,17,4);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you don't format num as best15, it will appear using scientific notation.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2019 15:20:40 GMT</pubDate>
    <dc:creator>profaddae</dc:creator>
    <dc:date>2019-06-21T15:20:40Z</dc:date>
    <item>
      <title>How to extract a specific string please</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-specific-string-please/m-p/567912#M159761</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone help me with this issue please? The column is currently is like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;30012324431440~~PABC&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to extract the 30012324431440 (number part) and PABC(character part) into two different column. And the separation part is ~~.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 13:46:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-specific-string-please/m-p/567912#M159761</guid>
      <dc:creator>septemberbulb</dc:creator>
      <dc:date>2019-06-21T13:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific string please</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-specific-string-please/m-p/567915#M159763</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Splitting-a-delimited-column-into-multiple-columns/td-p/351130" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Splitting-a-delimited-column-into-multiple-columns/td-p/351130&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data split;
   set test;
   length var1-var2 $15.;
   array var(2) $;
   do i = 1 to dim(var);
      var[i]=scan(row,i,'~~');
   end;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 14:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-specific-string-please/m-p/567915#M159763</guid>
      <dc:creator>Tommy1</dc:creator>
      <dc:date>2019-06-21T14:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific string please</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-specific-string-please/m-p/567925#M159769</link>
      <description>&lt;P&gt;One way:&lt;/P&gt;
&lt;PRE&gt;data example;
   str="30012324431440~~PABC";
   numpart = scan(str,1,'~');
   Charpart = scan(str,2,'~');
run;&lt;/PRE&gt;
&lt;P&gt;The Scan function will treat multiple adjacent delimiters, such as the ~, as a single "word" value.&lt;/P&gt;
&lt;P&gt;If you want to have an actual numeric value for the numeral part you could add&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;numeric = input(numpart,15.);&lt;/P&gt;
&lt;P&gt;but if you have more than 15 digits you will likely run&amp;nbsp;into numeric precision storage issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 14:25:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-specific-string-please/m-p/567925#M159769</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-21T14:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific string please</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-specific-string-please/m-p/567956#M159786</link>
      <description>&lt;P&gt;data work.one;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numchar='30012324431440~~PABC';&lt;BR /&gt;&amp;nbsp;&amp;nbsp; format num best15.;&lt;BR /&gt;&amp;nbsp; num=input(substr(numchar,1,14),14.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; char=substr(numchar,17,4);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you don't format num as best15, it will appear using scientific notation.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 15:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-specific-string-please/m-p/567956#M159786</guid>
      <dc:creator>profaddae</dc:creator>
      <dc:date>2019-06-21T15:20:40Z</dc:date>
    </item>
  </channel>
</rss>

