<?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 numbers from variable with character and numeric features in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668415#M200357</link>
    <description>Thanks you</description>
    <pubDate>Fri, 10 Jul 2020 16:56:33 GMT</pubDate>
    <dc:creator>michokwu</dc:creator>
    <dc:date>2020-07-10T16:56:33Z</dc:date>
    <item>
      <title>extract numbers from variable with character and numeric features</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668092#M200188</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;I have a variable that includes both characters and numbers and does not follow any specific coding standard as it has been obtained from multiple sources. I would just like to collect the numbers. I can't use &lt;STRONG&gt;substr&lt;/STRONG&gt; because the codes are different. Is there a way I can do this?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;have&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;want&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;BIOL10128DCWC&lt;/TD&gt;&lt;TD&gt;10128&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ANT102&lt;/TD&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PSY125&lt;/TD&gt;&lt;TD&gt;125&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SOC101&lt;/TD&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SPAN2330&lt;/TD&gt;&lt;TD&gt;2330&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;HIST1500&lt;/TD&gt;&lt;TD&gt;1500&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;BCS-205&lt;/TD&gt;&lt;TD&gt;205&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;BCS-132&lt;/TD&gt;&lt;TD&gt;132&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 09 Jul 2020 16:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668092#M200188</guid>
      <dc:creator>michokwu</dc:creator>
      <dc:date>2020-07-09T16:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: extract numbers from variable with character and numeric features</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668097#M200190</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;want=compress(have, '', 'A');&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Jul 2020 16:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668097#M200190</guid>
      <dc:creator>ghosh</dc:creator>
      <dc:date>2020-07-09T16:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: extract numbers from variable with character and numeric features</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668104#M200193</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _new;
informat have $32.;
input have $ var2;
want=compress(compress(have,' +/*-%','A'));
cards;
BIOL10128DCWc	10128
ANT102	102
PSY125	125
SOC101	101
SPAN2330	2330
HIST1500	1500
BCS-205	205
BCS-132	132
;;;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Jul 2020 17:12:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668104#M200193</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-07-09T17:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: extract numbers from variable with character and numeric features</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668126#M200216</link>
      <description>&lt;P&gt;Thanks! This works but it includes special characters. How do I get only the numbers?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 18:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668126#M200216</guid>
      <dc:creator>michokwu</dc:creator>
      <dc:date>2020-07-09T18:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: extract numbers from variable with character and numeric features</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668131#M200219</link>
      <description>Did not not see my response, that is what 'A' modifier does.   &lt;BR /&gt;want=compress(have, '', 'A');&lt;BR /&gt;It says, replace alpha with nothing&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Jul 2020 18:25:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668131#M200219</guid>
      <dc:creator>ghosh</dc:creator>
      <dc:date>2020-07-09T18:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: extract numbers from variable with character and numeric features</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668190#M200246</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you! Some of observations still include special characters.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 21:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668190#M200246</guid>
      <dc:creator>michokwu</dc:creator>
      <dc:date>2020-07-09T21:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: extract numbers from variable with character and numeric features</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668224#M200270</link>
      <description>&lt;P&gt;Try it this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;want = compress(have, , 'kd');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As the third parameter, kd = keep digits&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2020 00:17:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668224#M200270</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-07-10T00:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: extract numbers from variable with character and numeric features</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668415#M200357</link>
      <description>Thanks you</description>
      <pubDate>Fri, 10 Jul 2020 16:56:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extract-numbers-from-variable-with-character-and-numeric/m-p/668415#M200357</guid>
      <dc:creator>michokwu</dc:creator>
      <dc:date>2020-07-10T16:56:33Z</dc:date>
    </item>
  </channel>
</rss>

