<?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 Parse dollar amount from text string using Base SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279862#M56452</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with how to&amp;nbsp;parse dollar amounts&amp;nbsp;from a Text variable&amp;nbsp;in Base SAS? The challenge is the textg string doesn't have uniform formats, like $100.50 could be entered as&amp;nbsp;100.50 or even $ 100.50. The only constant would be '.XX' with&amp;nbsp;varying number of characters to the left of the decimal point. Any help is appreciated.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jun 2016 22:17:35 GMT</pubDate>
    <dc:creator>Conundrum</dc:creator>
    <dc:date>2016-06-23T22:17:35Z</dc:date>
    <item>
      <title>Parse dollar amount from text string using Base SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279862#M56452</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with how to&amp;nbsp;parse dollar amounts&amp;nbsp;from a Text variable&amp;nbsp;in Base SAS? The challenge is the textg string doesn't have uniform formats, like $100.50 could be entered as&amp;nbsp;100.50 or even $ 100.50. The only constant would be '.XX' with&amp;nbsp;varying number of characters to the left of the decimal point. Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 22:17:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279862#M56452</guid>
      <dc:creator>Conundrum</dc:creator>
      <dc:date>2016-06-23T22:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Parse dollar amount from text string using Base SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279864#M56454</link>
      <description>&lt;P&gt;Remove the $ with compress statement and then convert to a numeric variable with an input function.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 22:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279864#M56454</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-23T22:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Parse dollar amount from text string using Base SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279869#M56459</link>
      <description>&lt;P&gt;I forgot to add this is a comment field where there is more than just the dollar amount in the text field, it will have for instance, 'amount of $100.50 entered on MM/DD/YYYY due to xyz'. I want to create a new variable that just has the amount of 100.50 for this example.&amp;nbsp;Will this solution work for this scenario?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 22:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279869#M56459</guid>
      <dc:creator>Conundrum</dc:creator>
      <dc:date>2016-06-23T22:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Parse dollar amount from text string using Base SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279873#M56461</link>
      <description>&lt;P&gt;No, that's a big difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post several of the variations that you have, preferably one of each. The best solution will be a PRX but I'm not good at that.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 23:17:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279873#M56461</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-23T23:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Parse dollar amount from text string using Base SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279920#M56486</link>
      <description>&lt;P&gt;This should be able to deal with all kinds of circumstances:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=i i1 field);
set have;
length field $20;
i = findc(instring,'.',1);
do while (i ne 0);
  if notdigit(substr(instring,i+1,2)) = 0
  then do;
    i1 = i - 1;
    do while (notdigit(substr(instring,i1,1)) = 0);
      i1 + (-1);
    end;
    field = substr(instring,i1+1,i+2-i1);
    amount = input(field,20.2);
    i = 0;
  end;
  else i = findc(instring,'.',i+1);
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2016 07:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/279920#M56486</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-06-24T07:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Parse dollar amount from text string using Base SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/280004#M56521</link>
      <description>&lt;P&gt;This worked great and exactly what I needed. I will tweak this code for the instances where there was no decimal point and only had like&amp;nbsp;'$20' for the amount.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 14:37:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-dollar-amount-from-text-string-using-Base-SAS/m-p/280004#M56521</guid>
      <dc:creator>Conundrum</dc:creator>
      <dc:date>2016-06-24T14:37:53Z</dc:date>
    </item>
  </channel>
</rss>

