<?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 Format large number? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402049#M278784</link>
    <description>&lt;P&gt;I am running some Proc SQL queries e.g. MAX(variable) where the result cannot be displayed correctly due to the size of the number. How do I format this within the query to see the actual number?&lt;/P&gt;</description>
    <pubDate>Sat, 07 Oct 2017 09:03:22 GMT</pubDate>
    <dc:creator>amorts</dc:creator>
    <dc:date>2017-10-07T09:03:22Z</dc:date>
    <item>
      <title>Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402049#M278784</link>
      <description>&lt;P&gt;I am running some Proc SQL queries e.g. MAX(variable) where the result cannot be displayed correctly due to the size of the number. How do I format this within the query to see the actual number?&lt;/P&gt;</description>
      <pubDate>Sat, 07 Oct 2017 09:03:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402049#M278784</guid>
      <dc:creator>amorts</dc:creator>
      <dc:date>2017-10-07T09:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402052#M278785</link>
      <description>&lt;P&gt;Can you add an example of your currently attemped code and data so we get the picture (literally)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance, Jan.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Oct 2017 09:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402052#M278785</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2017-10-07T09:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402066#M278786</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165823"&gt;@amorts&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;The correct answer might depend on the details of what you're doing which you haven't told us. As a generic answer: Try using format BEST32., i.e. in your SQL:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select&lt;/P&gt;
&lt;P&gt;&amp;nbsp; max(&amp;lt;variable&amp;gt;) as max_var format=best32. ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ....&lt;/P&gt;</description>
      <pubDate>Sat, 07 Oct 2017 10:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402066#M278786</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-10-07T10:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402068#M278787</link>
      <description>Ok thanks. I don't have access to the code right now but I'll post an example on Monday</description>
      <pubDate>Sat, 07 Oct 2017 11:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402068#M278787</guid>
      <dc:creator>amorts</dc:creator>
      <dc:date>2017-10-07T11:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402298#M278788</link>
      <description>Ok so the field is stored as a num format 17.2.&lt;BR /&gt;&lt;BR /&gt;The result from the max is 5E8&lt;BR /&gt;&lt;BR /&gt;Applying the best32. Works and returns the result 500000000</description>
      <pubDate>Mon, 09 Oct 2017 08:49:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402298#M278788</guid>
      <dc:creator>amorts</dc:creator>
      <dc:date>2017-10-09T08:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402386#M278789</link>
      <description>&lt;P&gt;You can specify the format to attach to a variable you are deriving in SQL code by adding the FORMAT= keyword.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  num=5E13 ;
  format num 17.2 ;
run;
proc sql ;
  create table want as
    select max(num) as unformatted 
         , max(num) as formatted format=17.2 
    from have
  ;
quit;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    unformatted            formatted

 1          5E13      50000000000000.00&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Update from Community Manager&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/34537"&gt;@BeverlyBrown&lt;/a&gt;: Further context to the solution from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;in &lt;A href="https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402406/highlight/true#M278791" target="_self"&gt;this comment&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 13:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402386#M278789</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-11T13:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402390#M278790</link>
      <description>Ok thanks.&lt;BR /&gt;Why doesn't it inherit the data type from the incoming data? What does it default to?&lt;BR /&gt;</description>
      <pubDate>Mon, 09 Oct 2017 15:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402390#M278790</guid>
      <dc:creator>amorts</dc:creator>
      <dc:date>2017-10-09T15:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402406#M278791</link>
      <description>&lt;P&gt;PROC SQL will not assign formats to derived variables. It really cannot tell the difference between a function like MAX() that does not change the type or range of values and an operation like DATEPART() that could change the meaning of the numbers or SUM() that could change the range of values and hence require a different width for format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS will normally using BEST12. format to display numbers that do not have a format specification.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2017 15:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/402406#M278791</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-09T15:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/699004#M278792</link>
      <description>thank you very much, that worked!</description>
      <pubDate>Sun, 15 Nov 2020 22:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/699004#M278792</guid>
      <dc:creator>Siarhei_B</dc:creator>
      <dc:date>2020-11-15T22:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/701781#M278793</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/355084"&gt;@Siarhei_B&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you flag the correct answer as such? This would tell us which of the many responses is the correct one and would also add to the karma of the person that gave that answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Correction: that would be a question for &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165823"&gt;@amorts&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;-- Jan.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 10:34:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/701781#M278793</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2020-11-26T10:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/701786#M278794</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/355084"&gt;@Siarhei_B&lt;/a&gt;&amp;nbsp;is not the OP, and cannot accept a solution for the thread.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 09:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/701786#M278794</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-26T09:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/701790#M278795</link>
      <description>Ah yes I see. Thanks for pointing that out Kurt. I will make a correction.</description>
      <pubDate>Thu, 26 Nov 2020 10:33:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/701790#M278795</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2020-11-26T10:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Format large number?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/701796#M278796</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12460"&gt;@jklaverstijn&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Ah yes I see. Thanks for pointing that out Kurt. I will make a correction.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Won't do much. The threadstarter has not visited the communities since 2017.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 11:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-large-number/m-p/701796#M278796</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-26T11:06:49Z</dc:date>
    </item>
  </channel>
</rss>

