<?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: Regular Expressions: Extracting the price from a string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215076#M39671</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="2746" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The question is now if these are unsupported features or just something missing in the documentation. I've asked SAS TechSupport this question and will post the answer here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here how this could work using the REGEXPE option:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; invalue Price (default=20)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 's/.*\$(\d+\.?\d*).*/\1/' (REGEXPE) = [best32.]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; other=0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input pt &amp;amp;:Price.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;Aug Earn $25 v2 external&lt;/P&gt;&lt;P&gt;Aug Earns $125.45 v2 external&lt;/P&gt;&lt;P&gt;Aug Earns $50 v2 external&lt;/P&gt;&lt;P&gt;Aug Earns v2 external&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 27 Jun 2015 22:12:15 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2015-06-27T22:12:15Z</dc:date>
    <item>
      <title>Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215064#M39659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Hi, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I’m trying to extract a price from a string and I’m having some with my code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I start with: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="width: 170px; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;" width="170"&gt;PROMOTION_TITLE &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;Aug Earn $25 v2 external &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;Aug Earns $125 v2 external &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;Aug Earns $50 v2 external &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I need: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="width: 116px; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="color: rgb(87, 87, 87); text-align: center; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;" width="116"&gt;Price&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="19" style="color: rgb(87, 87, 87); text-align: center; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;$25 &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="19" style="color: rgb(87, 87, 87); text-align: center; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;$125 &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="19" style="color: rgb(87, 87, 87); text-align: center; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;$50 &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my program so far. I can't seem to get the syntax right. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test (keep=PROMOTION_TITLE price) ;&lt;/P&gt;&lt;P&gt;set&amp;nbsp; a.promo;&lt;/P&gt;&lt;P&gt;&amp;nbsp; price =(input(prxchange('s/(\w+)_(\d+)_(\w+)/$2/',-1,PROMOTION_TITLE),8.))/100;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format price dollar8.2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance will be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 18:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215064#M39659</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2015-06-26T18:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215065#M39660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Consider other SAS functions...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* DATA step with instream data-rows for illustration. ;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;input ;&lt;/P&gt;&lt;P&gt;format price dollar8.2 ; &lt;/P&gt;&lt;P&gt;* parse input record and extract dollar-amount, convert to numeric. ;&lt;/P&gt;&lt;P&gt;price = input(scan(substr(_infile_,find(_infile_,'$','t')+1),1,' '),8.);&lt;/P&gt;&lt;P&gt;putlog _all_;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;Aug Earn $25 v2 external&amp;nbsp; &lt;/P&gt;&lt;P&gt;Aug Earns $125 v2 external&amp;nbsp; &lt;/P&gt;&lt;P&gt;Aug Earns $50 v2 external&amp;nbsp; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Scott Barry&lt;/P&gt;&lt;P&gt;SBBWorks, Inc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 19:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215065#M39660</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2015-06-26T19:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215066#M39661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This looks about right.&amp;nbsp; Instead of removing everything around the dollar amount use a capture buffer to retrieve it.&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; test;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; PROMOTION_TITLE &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$80.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;retain&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; rx;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; _n_ eq &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; rx = prxparse(&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'/(\$\d+\.?\d?\d?)/'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; prxmatch(rx,promotion_title) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; price = prxposn(rx,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,promotion_title);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;cards&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;Aug Earn $25 v2 external &lt;BR /&gt;Aug Earns $125.75x v2 external &lt;BR /&gt;Aug Earns $50 v2 external &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;;;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;print&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 19:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215066#M39661</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-06-26T19:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215067#M39662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;input&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;price =prxchange('s/.*(\$\d+).*/\1/',-1,_infile_) ;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;Aug Earn $25 v2 external &lt;/P&gt;&lt;P&gt;Aug Earns $125 v2 external &lt;/P&gt;&lt;P&gt;Aug Earns $50 v2 external &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 20:10:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215067#M39662</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2015-06-26T20:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215068#M39663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is good but is it possible to change the var to numeric? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 20:12:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215068#M39663</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2015-06-26T20:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215069#M39664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 20:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215069#M39664</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-06-26T20:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215070#M39665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My proposition is similar to DN's :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input pt &amp;amp;:$32.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Aug Earn $25 v2 external&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Aug Earns $125 v2 external&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Aug Earns $50 v2 external&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if not prxId then prxId + prxparse("/\$\s?\d+(\.\d{2})?/");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;call prxsubstr(prxId, pt, pos, len);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if pos &amp;gt; 0 then price = input (substr(pt, pos, len), dollar10.);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;format price dollar11.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drop prxId pos len;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print data=want noobs; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 05:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215070#M39665</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-06-27T05:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215071#M39666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is a feature in proc format that enableS the definition of the prx in a INVALUE range &lt;/P&gt;&lt;P&gt;The feature has been there for a few years. Rick Langston has been demonstrating it at SAS GF (along with the concept of using a function in&amp;nbsp; "label" area.)&lt;/P&gt;&lt;P&gt;Once compiled the syntax to pull that "price" could just be the usual INPUT statement with the very unusual user INFORMAT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 08:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215071#M39666</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2015-06-27T08:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215072#M39667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for this pointer to informats and RegEx: &lt;A href="https://support.sas.com/resources/papers/proceedings12/245-2012.pdf" title="https://support.sas.com/resources/papers/proceedings12/245-2012.pdf"&gt;https://support.sas.com/resources/papers/proceedings12/245-2012.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 08:56:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215072#M39667</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-06-27T08:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215073#M39668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick&lt;/P&gt;&lt;P&gt;you're welcome. And thanks for reporting the link.&lt;/P&gt;&lt;P&gt;Of course, it doesn't make prx any simpler&amp;nbsp;&amp;nbsp; just their implementation&amp;nbsp; &lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 09:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215073#M39668</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2015-06-27T09:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215074#M39669</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 pt &amp;amp;:$32.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;Aug Earn $25 v2 external&lt;/P&gt;&lt;P&gt;Aug Earns $125 v2 external&lt;/P&gt;&lt;P&gt;Aug Earns $50 v2 external&lt;/P&gt;&lt;P&gt;Aug Earns $125.01 v2 external&lt;/P&gt;&lt;P&gt;Aug Earns $50x v2 external&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;You can parse using double scan (it will be faster than prx)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;price=input(scan(scan(pt,2,'$'),1,,'as'),best.);&lt;/P&gt;&lt;P&gt;format price dollar8.2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Alternatively, using prx function&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;data want2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;re=prxparse('#(?&amp;lt;=\$)(\d+(\.\d{2})?)#');&lt;/P&gt;&lt;P&gt;format price dollar8.2;&lt;/P&gt;&lt;P&gt;do until(done);&lt;/P&gt;&lt;P&gt;set have end=done;&lt;/P&gt;&lt;P&gt;if prxmatch(re,pt) then do;&lt;/P&gt;&lt;P&gt;price=input(prxposn(re,1,pt),best.);&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&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;EM&gt;&lt;STRONG&gt;Using a regexpe informat&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;invalue ReDollar 's#^.*(?&amp;lt;=\$)(\d+(\.\d{2})?).*$#\1#' (regexpe) = [14.];&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want3;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;price=input(pt,ReDollar.);&lt;/P&gt;&lt;P&gt;format price dollar8.2;&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;^.*(?&amp;lt;=\$)(\d+(\.\d{2})?).*$&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Options: ^ and $ match at line breaks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assert position at the beginning of a line (at beginning of the string or after a line break character) «^»&lt;/P&gt;&lt;P&gt;Match any single character that is not a line break character «.*»&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»&lt;/P&gt;&lt;P&gt;Assert that the regex below can be matched, with the match ending at this position (positive lookbehind) «(?&amp;lt;=\$)»&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Match the character “$” literally «\$»&lt;/P&gt;&lt;P&gt;Match the regular expression below and capture its match into backreference number 1 «(\d+(\.\d{2})?)»&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Match a single digit 0..9 «\d+»&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Match the regular expression below and capture its match into backreference number 2 «(\.\d{2})?»&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Between zero and one times, as many times as possible, giving back as needed (greedy) «?»&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Match the character “.” literally «\.»&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Match a single digit 0..9 «\d{2}»&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exactly 2 times «{2}»&lt;/P&gt;&lt;P&gt;Match any single character that is not a line break character «.*»&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»&lt;/P&gt;&lt;P&gt;Assert position at the end of a line (at the end of the string or before a line break character) «$»&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 14:33:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215074#M39669</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2015-06-27T14:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215075#M39670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Patrick and Peter, very good to know. I wish ALL the features of my licenced SAS software were described in the main doc.I find &lt;STRONG&gt;proc format&lt;/STRONG&gt; particularly poor in that respect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 17:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215075#M39670</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-06-27T17:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215076#M39671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="2746" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The question is now if these are unsupported features or just something missing in the documentation. I've asked SAS TechSupport this question and will post the answer here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here how this could work using the REGEXPE option:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; invalue Price (default=20)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 's/.*\$(\d+\.?\d*).*/\1/' (REGEXPE) = [best32.]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; other=0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input pt &amp;amp;:Price.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;Aug Earn $25 v2 external&lt;/P&gt;&lt;P&gt;Aug Earns $125.45 v2 external&lt;/P&gt;&lt;P&gt;Aug Earns $50 v2 external&lt;/P&gt;&lt;P&gt;Aug Earns v2 external&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 22:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215076#M39671</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-06-27T22:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215077#M39672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After a bit of experimenting with the PRX - INFORMAT technique, starting with &lt;A __default_attr="733023" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;'s third example, I came to :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc format;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;invalue ReDollar (default=32767)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;'s#.*\$\s?(\d+(\.\d{2})?).*#\1#' (regexpe) = [12.];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data want3;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;price=input(pt, ReDollar.);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;format price dollar8.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dropped the non-capturing group and the begin-end assertions from the pattern since they are not required. I changed the label informat &lt;STRONG&gt;dollar8.2&lt;/STRONG&gt; to &lt;STRONG&gt;12.&lt;/STRONG&gt; as it divided the price by 100. Most importantly, I specified a large default size for the informat; otherwise, longer input strings were truncated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jun 2015 04:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215077#M39672</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-06-28T04:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215078#M39673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is important to note that in the case where a variable this format would be applied to includes more that one valid dollar value, the last one will be returned.&amp;nbsp; This is true of all the examples: mine, &lt;A __default_attr="12296" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;, &lt;A __default_attr="2746" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is because of the use of the greedy match at the beginning (.*), if you alternatively wanted to retrieve the first match, you could modify this to be a lazy match (.*?)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jun 2015 05:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215078#M39673</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2015-06-28T05:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215079#M39674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="2746" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The answer I've got from SAS TechSupport: REGEXP and REGEXPE are supported features. The SAS documentation will get updated and they will be fully documented in the future.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2015 23:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215079#M39674</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-06-29T23:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions: Extracting the price from a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215080#M39675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Patrick! According to &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Rick Langston's paper, the feature was introduced with SAS 9.3. Makes me wonder how many goodies I am missing. Maybe the slow disclosure rate is just another step in the testing process. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 01:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expressions-Extracting-the-price-from-a-string/m-p/215080#M39675</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-06-30T01:03:07Z</dc:date>
    </item>
  </channel>
</rss>

