<?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: Rounding the output with SAS DB2 SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830532#M328177</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/371433"&gt;@JC411911&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0kl9qj532rbqln187us4ao371h7.htm" target="_blank" rel="noopener"&gt;Example 4:&amp;nbsp;Creating a Picture Format for Large Dollar Amounts&lt;/A&gt; of the PROC FORMAT documentation explains how to create a picture format the second version of which comes very close to what you want. Can you try to adapt that format to your needs (in particular, add the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0n990vq8gxca6n1vnsracr6jp2c.htm#p1fh7u9t4ya6fgn15mc3niroo9a0" target="_blank" rel="noopener"&gt;ROUND option&lt;/A&gt; to the PICTURE statement)?&lt;/P&gt;</description>
    <pubDate>Fri, 26 Aug 2022 10:34:10 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2022-08-26T10:34:10Z</dc:date>
    <item>
      <title>Rounding the output with SAS DB2 SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830447#M328146</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;I am running db2 sql in SAS via a passthru and that is working fine. The issue I am having is getting my output to round. I have tried different options via format= but cant get desired results.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE class=""&gt;&lt;CODE class=""&gt;PROC &lt;SPAN class=""&gt;SQL&lt;/SPAN&gt;;
        &lt;SPAN class=""&gt;CREATE&lt;/SPAN&gt; &lt;SPAN class=""&gt;TABLE&lt;/SPAN&gt; WORK.ISSUES1671 &lt;SPAN class=""&gt;AS&lt;/SPAN&gt;  
        &lt;SPAN class=""&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class=""&gt;*&lt;/SPAN&gt; &lt;SPAN class=""&gt;FROM&lt;/SPAN&gt; CONNECTION &lt;SPAN class=""&gt;TO&lt;/SPAN&gt; MYDB ( 

        &lt;SPAN class=""&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class=""&gt;COUNT&lt;/SPAN&gt;(&lt;SPAN class=""&gt;DISTINCT&lt;/SPAN&gt; ISSUE_ID) &lt;SPAN class=""&gt;AS&lt;/SPAN&gt; ISSUE_ID,
            &lt;SPAN class=""&gt;SUM&lt;/SPAN&gt;(PAID_TO_DT_AMT) &lt;SPAN class=""&gt;AS&lt;/SPAN&gt; PAID_TO_DATE_YTD

        &lt;SPAN class=""&gt;FROM&lt;/SPAN&gt; LOD.RMD

            );
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;this gives me a table with this ISSUE_ID PAID_TO_DATE_YTD 3746 1015768311.9&lt;/P&gt;&lt;P&gt;I then have this:&lt;/P&gt;&lt;PRE class=""&gt;&lt;CODE class=""&gt;PROC &lt;SPAN class=""&gt;SQL&lt;/SPAN&gt;;
    &lt;SPAN class=""&gt;SELECT&lt;/SPAN&gt; 
        &lt;SPAN class=""&gt;sum&lt;/SPAN&gt;(PAID_TO_DATE_YTD&lt;SPAN class=""&gt;-843686339.02&lt;/SPAN&gt;) &lt;SPAN class=""&gt;AS&lt;/SPAN&gt; PAIDOUT_YTD FORMAT&lt;SPAN class=""&gt;=&lt;/SPAN&gt; DOLLAR18&lt;SPAN class=""&gt;.2&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;FROM&lt;/SPAN&gt; WORK.ISSUES1671;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which gives me this $172,081,972.83 which is correct but I want it to round to $172.1&lt;/P&gt;&lt;P&gt;I tried using the round function but it still gives me wonky results.&lt;/P&gt;&lt;P&gt;Any help or ideas on how I can get this to show?&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 25 Aug 2022 21:56:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830447#M328146</guid>
      <dc:creator>JC411911</dc:creator>
      <dc:date>2022-08-25T21:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding the output with SAS DB2 SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830532#M328177</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/371433"&gt;@JC411911&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0kl9qj532rbqln187us4ao371h7.htm" target="_blank" rel="noopener"&gt;Example 4:&amp;nbsp;Creating a Picture Format for Large Dollar Amounts&lt;/A&gt; of the PROC FORMAT documentation explains how to create a picture format the second version of which comes very close to what you want. Can you try to adapt that format to your needs (in particular, add the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0n990vq8gxca6n1vnsracr6jp2c.htm#p1fh7u9t4ya6fgn15mc3niroo9a0" target="_blank" rel="noopener"&gt;ROUND option&lt;/A&gt; to the PICTURE statement)?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 10:34:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830532#M328177</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-08-26T10:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding the output with SAS DB2 SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830693#M328237</link>
      <description>&lt;P&gt;Hello thank you for the suggestion I tried that but still don't get near what I am looking for. In fact the format was different then what I would expect using that option.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc format;   
   picture bigmoney (fuzz=0)
      1E06-&amp;lt;1000000000='0000 M' (prefix='$' mult=.000001);
	  value paidout;
run;

PROC SQL;
	SELECT 
		sum(PAID_TO_DATE_YTD-843686339.02) AS PAIDOUT_YTD format=paidout.
	FROM WORK.ISSUES1671;
QUIT;&lt;/PRE&gt;&lt;DIV&gt;172132494.79&lt;/DIV&gt;&lt;DIV&gt;PAIDOUT_YTD&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 22:15:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830693#M328237</guid>
      <dc:creator>JC411911</dc:creator>
      <dc:date>2022-08-26T22:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding the output with SAS DB2 SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830694#M328238</link>
      <description>The format name is bigmoney, not paidout.</description>
      <pubDate>Fri, 26 Aug 2022 22:21:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830694#M328238</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-26T22:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding the output with SAS DB2 SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830696#M328240</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;Thank you that worked I was under the assumption that the value was my format name. While it worked I would like it to round to one decimal place. I tried using the round function and then the format option but to no avail. Any ideas on how I can get it to round to 172.1 rather than just 172&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format;   
   picture bigmoney (fuzz=0)
      1E06-&amp;lt;1000000000='0000 M' (prefix='$' mult=.000001);
	  value paidout;
run;

PROC SQL;
	SELECT 
		round(sum(PAID_TO_DATE_YTD-843686339.02),.1) AS PAIDOUT_YTD format=bigmoney.
	FROM WORK.ISSUES1671;
QUIT;&lt;/PRE&gt;
&lt;P&gt;$172 M&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 22:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830696#M328240</guid>
      <dc:creator>JC411911</dc:creator>
      <dc:date>2022-08-26T22:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding the output with SAS DB2 SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830699#M328243</link>
      <description>&lt;P&gt;When dealing with formats that use the MULT option you may have to provide the rounding because of the way the MULT result is overlaid onto the Picture.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example that extends the Picture, modifies the MULT value to match the new picture and an example using it.&lt;/P&gt;
&lt;P&gt;Do note that range used for ROUND in this case is to the 100,000ths.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format;   
   picture bigmoney  (fuzz=0)
      1E06-&amp;lt;1000000000='0000.0 M' (prefix='$' mult=.00001);
	  value paidout;
run;

data example;
   x= 172092837;
   put x= bigmoney.;
   y=round(x,100000);
   put y= bigmoney.;
run;&lt;/PRE&gt;
&lt;P&gt;The Log will show the results of applying the format. I know this is not the SQL but does demonstrate&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 23:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830699#M328243</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-08-26T23:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding the output with SAS DB2 SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830701#M328245</link>
      <description>&lt;P&gt;Thank you I was finally able to achieve the results I wanted using the below:&lt;/P&gt;
&lt;PRE&gt;1proc format;   
   picture bigmoney (fuzz=0)
      1E06-&amp;lt;1000000000='00000.0 M' (prefix='$' mult=.00001);
run;

PROC SQL;
	SELECT 
		sum(PAID_TO_DATE_YTD-843686339.02) AS PAIDOUT_YTD format=bigmoney.
	FROM WORK.ISSUES1671;
QUIT;
&lt;BR /&gt;&lt;BR /&gt;$172.1M&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2022 23:23:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830701#M328245</guid>
      <dc:creator>JC411911</dc:creator>
      <dc:date>2022-08-26T23:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding the output with SAS DB2 SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830703#M328246</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/371433"&gt;@JC411911&lt;/a&gt; - You may also want to use the PICTURE format ROUND option as the default action is to truncate decimals.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 23:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-the-output-with-SAS-DB2-SQL/m-p/830703#M328246</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-08-26T23:42:31Z</dc:date>
    </item>
  </channel>
</rss>

