<?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 only in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21278#M3411</link>
    <description>Thanks for your response.</description>
    <pubDate>Tue, 21 Apr 2009 13:45:51 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2009-04-21T13:45:51Z</dc:date>
    <item>
      <title>Extract digits only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21274#M3407</link>
      <description>Hi All,&lt;BR /&gt;
 I need to extract only digits from a variable.Say for instance I have a field "drug name" with values Symbort 25 mg, Avalide 125 ml,Xyntha 1050.&lt;BR /&gt;
I need only 25,125 1050.&lt;BR /&gt;
Thanks for your time and help,</description>
      <pubDate>Mon, 20 Apr 2009 21:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21274#M3407</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-04-20T21:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21275#M3408</link>
      <description>You can use the compress function to strip all of the characters. All the letters of the alphabet are listed in both upper and lower case within quotes. The result will be a character variable containing only the digits. You can then use an input function to convert the character to a numeric.&lt;BR /&gt;
&lt;BR /&gt;
data file;&lt;BR /&gt;
  set file;&lt;BR /&gt;
  number=compress(drug_name,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I'm sure that there is a more elegant solution but this one works.</description>
      <pubDate>Tue, 21 Apr 2009 00:47:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21275#M3408</guid>
      <dc:creator>barheat</dc:creator>
      <dc:date>2009-04-21T00:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21276#M3409</link>
      <description>compress(drug_name,,a) gives the same results.  See the documentation for COMPRESS.0&lt;BR /&gt;
&lt;BR /&gt;
What about fields with two numbers int hem?  Say "Vytorin 10/80'?  The code above gives '10/80' as the result but that may not be what you want.  COMPRESS has lots of options to give you more control on the parsing.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke</description>
      <pubDate>Tue, 21 Apr 2009 02:56:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21276#M3409</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-04-21T02:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21277#M3410</link>
      <description>Hi Doc@duke,&lt;BR /&gt;
Thanks for the help.Yes there is ambiguity regarding this situation drug 10/80.</description>
      <pubDate>Tue, 21 Apr 2009 13:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21277#M3410</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-04-21T13:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21278#M3411</link>
      <description>Thanks for your response.</description>
      <pubDate>Tue, 21 Apr 2009 13:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21278#M3411</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-04-21T13:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Extract digits only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21279#M3412</link>
      <description>You could use the regular expression functions to extract the digits, but  as stated before, COMPRESS function would be most direct and simple way&lt;BR /&gt;
&lt;BR /&gt;
Check the online documentation for the compress function (and its modifiers):&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000212246.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000212246.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Greetings from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos at &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
      <pubDate>Tue, 21 Apr 2009 20:10:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-digits-only/m-p/21279#M3412</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-04-21T20:10:02Z</dc:date>
    </item>
  </channel>
</rss>

