<?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: Hi I need to extract only the digits from a comment ... in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206337#M51292</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DATA TEST;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INFILE CARDS TRUNCOVER;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INPUT VAR $100.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DIGITS=scan(var,2,,'kd');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CARDS;&lt;/P&gt;&lt;P&gt;43534-PP - ABCDEF 150 ABC ABCD&lt;/P&gt;&lt;P&gt;07052-TT - ABCD 100 ABCDEFG&lt;/P&gt;&lt;P&gt;83092-DD -&amp;nbsp;&amp;nbsp; ABCDEFG 540 ABCDEFRGTH&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;&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>Fri, 20 Mar 2015 14:08:38 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2015-03-20T14:08:38Z</dc:date>
    <item>
      <title>Hi I need to extract only the digits from a comment ...</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206335#M51290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All, &lt;/P&gt;&lt;P&gt;Please help me to find out the solution for this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Comment is my variable ... i would like to extract only the Digit from the comment .For example&amp;nbsp; from the first line i need to extract 150 and from the second i want to extract 100 and so on .I tried with anydigit option but its not working as it only show 1 or 0 if there is any digit in the below comment.My date set large and have more than 10000 comments like this . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;43534-PP - ABCDEF 150 ABC ABCD&lt;/P&gt;&lt;P&gt;07052-TT - ABCD 100 ABCDEFG&lt;/P&gt;&lt;P&gt;83092-DD -&amp;nbsp;&amp;nbsp; ABCDEFG&amp;nbsp; 540 ABCDEFRGTH &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kanchan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2015 22:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206335#M51290</guid>
      <dc:creator>sarkar_kanchan</dc:creator>
      <dc:date>2015-03-19T22:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Hi I need to extract only the digits from a comment ...</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206336#M51291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems working on your as-is data:&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; TEST;&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;INFILE&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;CARDS&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;TRUNCOVER&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;&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; VAR &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$100.&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: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DIGITS=prxchange(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'s/^\d+\D+|\D+$//o'&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;,var);&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;43534-PP - ABCDEF 150 ABC ABCD&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;07052-TT - ABCD 100 ABCDEFG&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;83092-DD -&amp;nbsp;&amp;nbsp; ABCDEFG 540 ABCDEFRGTH&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; &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>Fri, 20 Mar 2015 13:43:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206336#M51291</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-03-20T13:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Hi I need to extract only the digits from a comment ...</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206337#M51292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DATA TEST;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INFILE CARDS TRUNCOVER;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INPUT VAR $100.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DIGITS=scan(var,2,,'kd');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CARDS;&lt;/P&gt;&lt;P&gt;43534-PP - ABCDEF 150 ABC ABCD&lt;/P&gt;&lt;P&gt;07052-TT - ABCD 100 ABCDEFG&lt;/P&gt;&lt;P&gt;83092-DD -&amp;nbsp;&amp;nbsp; ABCDEFG 540 ABCDEFRGTH&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;&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>Fri, 20 Mar 2015 14:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206337#M51292</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-03-20T14:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Hi I need to extract only the digits from a comment ...</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206338#M51293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or just use scan, nice one xia keshan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, without perl:&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input var $100.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; digits=compress(scan(var,3,'-'),' ','a');&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;43534-PP - ABCDEF 150 ABC ABCD&lt;/P&gt;&lt;P&gt;07052-TT - ABCD 100 ABCDEFG&lt;/P&gt;&lt;P&gt;83092-DD -&amp;nbsp;&amp;nbsp; ABCDEFG 540 ABCDEFRGTH&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Mar 2015 14:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206338#M51293</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-03-20T14:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hi I need to extract only the digits from a comment ...</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206339#M51294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice. Never see 'kd' option in SCAN(). Thanks for sharing!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well in this case, depending on OP's rules, DIGITS=scan(var,-1,,'kd'); will also be OK.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Mar 2015 14:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hi-I-need-to-extract-only-the-digits-from-a-comment/m-p/206339#M51294</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-03-20T14:18:11Z</dc:date>
    </item>
  </channel>
</rss>

