<?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: Doing a sum on a text field in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409476#M100044</link>
    <description>&lt;P&gt;DO you have any other suggestions? I don't mind it rounding the decimals up to about 6-7 places&lt;/P&gt;</description>
    <pubDate>Wed, 01 Nov 2017 14:24:56 GMT</pubDate>
    <dc:creator>zdassu</dc:creator>
    <dc:date>2017-11-01T14:24:56Z</dc:date>
    <item>
      <title>Doing a sum on a text field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409429#M100027</link>
      <description>&lt;P&gt;Hi I am trying to sum a column in a table, how ever although the column contains numbers they have been saved as text. I know in SQL you can use the following code but I am struggling to use this code in SAS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;select SUM(cast(AAAAAAAAAA as float))/1000000 from ##Temp1&lt;/PRE&gt;&lt;P&gt;Your help in this matter is much appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 12:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409429#M100027</guid>
      <dc:creator>zdassu</dc:creator>
      <dc:date>2017-11-01T12:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Doing a sum on a text field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409430#M100028</link>
      <description>&lt;P&gt;What does your data look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sounds like you need to convert the character values to numeric first and then calculate the sum from there, eg with PROC MEANS.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 12:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409430#M100028</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-11-01T12:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Doing a sum on a text field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409432#M100029</link>
      <description>&lt;P&gt;The data looks like this, quite a few decimal places&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;7333.83706005760236&lt;BR /&gt;-241.48477505034183&lt;BR /&gt;-3721.90979470953705&lt;BR /&gt;282.78293262436968&lt;BR /&gt;8401.59702862381179&lt;BR /&gt;319.66827473169031&lt;BR /&gt;9488.22997865952625&lt;BR /&gt;276.11825793635553&lt;BR /&gt;8379.37965250339576&lt;BR /&gt;1001.47034302957246&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 12:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409432#M100029</guid>
      <dc:creator>zdassu</dc:creator>
      <dc:date>2017-11-01T12:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Doing a sum on a text field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409433#M100030</link>
      <description>The equivalent of cast in SAS is input/put.  Put takes a numeric and creates a character based on the format, input takes a character and returns a numeric based on the informat.  Now these will give you a warning if there are items that cannot be converted, e.g. ABC cannot be numeric, these will be missing which is dot.  So yu could do:
select sum(input(text_var,best.)) as result</description>
      <pubDate>Wed, 01 Nov 2017 12:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409433#M100030</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-01T12:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Doing a sum on a text field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409438#M100032</link>
      <description>&lt;P&gt;Thanks for your help, worked just as you described&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 12:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409438#M100032</guid>
      <dc:creator>zdassu</dc:creator>
      <dc:date>2017-11-01T12:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Doing a sum on a text field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409466#M100040</link>
      <description>&lt;P&gt;With that many decimals you may run into numeric precision issues.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 13:57:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409466#M100040</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-11-01T13:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Doing a sum on a text field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409476#M100044</link>
      <description>&lt;P&gt;DO you have any other suggestions? I don't mind it rounding the decimals up to about 6-7 places&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 14:24:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409476#M100044</guid>
      <dc:creator>zdassu</dc:creator>
      <dc:date>2017-11-01T14:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Doing a sum on a text field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409674#M100095</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/59173"&gt;@zdassu&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;DO you have any other suggestions? I don't mind it rounding the decimals up to about 6-7 places&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I brought up the issue in case you considered all of those digits as significant. Your calculations involving such numbers could be off in the last one or two decimals (or more if enough calculations are done). You just need to know your data and treat as appropriate for your purpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I obviously don't have your data but if there are digits that are not actually significant that you carry through calculations then your result may imply precision that does not exist which has a chance of creating final statistics that are/are not significant based on using those values in a regression or similar procedure.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 22:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doing-a-sum-on-a-text-field/m-p/409674#M100095</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-11-01T22:54:03Z</dc:date>
    </item>
  </channel>
</rss>

