<?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: Extract digits in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137940#M27876</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reeza - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;based on your previous suggestion I made it work&lt;/P&gt;&lt;P&gt;Number1=scan(str,5,"#(())");&lt;/P&gt;&lt;P&gt;Number2=scan(str,3,"#()");&lt;/P&gt;&lt;P&gt;and then concatenated two columns. &lt;/P&gt;&lt;P&gt;It worked. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jun 2014 18:08:44 GMT</pubDate>
    <dc:creator>buckeyefisher</dc:creator>
    <dc:date>2014-06-11T18:08:44Z</dc:date>
    <item>
      <title>Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137932#M27868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to extract digits from a string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example a typical string is given as&amp;nbsp; =&amp;nbsp; PYRIDOSTIGMINE BROMIDE (NDA #020414)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to extract 020414. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having hard time telling SAS (pearl functions) to extract after # and stop before ')'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 13:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137932#M27868</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2014-06-11T13:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137933#M27869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data _null_ ;
a='PYRIDOSTIGMINE BROMIDE (NDA #020414)';
b=compress(a, ,'kd');
put a= b=;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 13:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137933#M27869</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-06-11T13:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137934#M27870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xia, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks but it does not give me exact solution. For example I have a string&amp;nbsp; "CLARITIN-D 24 HOUR (NDA #020470)" And I am looking to extract 020470. But your solution extracts - 24020470. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I want to use # to signal start of the number and ')' to signal end of the number. Any thoughts on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 14:47:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137934#M27870</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2014-06-11T14:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137935#M27871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the scan function if you have a consistent structure to the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sample=scan(word, 3, "()#");&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000214639.htm" title="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000214639.htm"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 14:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137935#M27871</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-11T14:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137936#M27872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;although the data structure is almost standard, sometimes there are multiple open and close brackets.&lt;/P&gt;&lt;P&gt;So my best bet is to recognize&amp;nbsp; symbol '#'. Is there a way to recognize that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 15:50:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137936#M27872</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2014-06-11T15:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137937#M27873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the scan function with # only as a delimiter and then again with the brackets or some combination thereof.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 16:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137937#M27873</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-11T16:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137938#M27874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;retain re;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if _N_ = 1 then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; re = prxparse("/#(\d+)\)/");&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;input str $ 1-40;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if prxmatch(re, str) then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; num = prxposn(re, 1, str);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;put num=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datalines;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;CLARITIN-D 24 HOUR (NDA #020470)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;PYRIDOSTIGMINE BROMIDE (NDA #020414)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 16:57:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137938#M27874</guid>
      <dc:creator>Tim_SAS</dc:creator>
      <dc:date>2014-06-11T16:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137939#M27875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input str $ 1-40;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;CLARITIN-D 24 HOUR (NDA #020470)&lt;/P&gt;&lt;P&gt;PYRIDOSTIGMINE BROMIDE (NDA #020414)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; number=scan(str, 2, "#)");&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 17:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137939#M27875</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-11T17:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137940#M27876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reeza - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;based on your previous suggestion I made it work&lt;/P&gt;&lt;P&gt;Number1=scan(str,5,"#(())");&lt;/P&gt;&lt;P&gt;Number2=scan(str,3,"#()");&lt;/P&gt;&lt;P&gt;and then concatenated two columns. &lt;/P&gt;&lt;P&gt;It worked. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 18:08:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137940#M27876</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2014-06-11T18:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137941#M27877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Time@SAS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your syntax works perfectly !!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 18:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137941#M27877</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2014-06-11T18:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137942#M27878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If using PRXCHANGE, the code can be less verbose:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; str $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;40&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num=prxchange(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'s/.+#(\d+).+/$1/io'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,str);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;CLARITIN-D 24 HOUR (NDA #020470)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;PYRIDOSTIGMINE BROMIDE (NDA #020414)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 18:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits/m-p/137942#M27878</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-06-11T18:32:40Z</dc:date>
    </item>
  </channel>
</rss>

