<?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: proc sql, output % to 2 decimal places in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169092#M264108</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brandon,&lt;/P&gt;&lt;P&gt;I think Reeza's and Jaap's comments are on point (including checking for bad variables names and the like). Please consider the nature of the comments and don't just copy and paste. The moral of the story is to know how formats work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep in mind that what SAS stores as data is not the same as what you see on the screen in output. You should use FORMAT to control what you see in output (and other output related things), as suggested by others above. Formats can be changed on the fly; defining a format in a dataset is only for convenience. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would avoid using the round function. See below for why you may not want to use the round function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Aug 2014 02:40:52 GMT</pubDate>
    <dc:creator>joe00033</dc:creator>
    <dc:date>2014-08-22T02:40:52Z</dc:date>
    <item>
      <title>proc sql, output % to 2 decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169087#M264103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;I have this code and my output is displaying 0.000315686 but I need it to read 3.15. I have tried to do this on the code but im not getting the result. Can someone please confirm the issues? &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; work.dtv1 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; month_date,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;balance_outstanding &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; balance,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;curr_index_val &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; val,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;round(balance/val denominator,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;0.00001&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; dtv &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;OL style="list-style-type: lower-alpha;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;gbasel.baseljul14&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; optimum_platform = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 10pt;"&gt;'Optimum'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; Arrears_lit_stage_code &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;not&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 10pt;"&gt;'L4'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 10pt;"&gt;'L5'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 10pt;"&gt;'L6'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;order&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; month_date;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Aug 2014 16:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169087#M264103</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2014-08-20T16:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql, output % to 2 decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169088#M264104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;That doesn't quite look like correct SAS code with the space in the variable name, I'll assume the editor ate a symbol or something. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;round(balance/val denominator,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;0.00001&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;)*10000 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; dtv format=8.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;from &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Aug 2014 17:12:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169088#M264104</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-08-20T17:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql, output % to 2 decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169089#M264105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;same question: &lt;A _jive_internal="true" href="https://communities.sas.com/message/222621"&gt;https://communities.sas.com/message/222621&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Aug 2014 17:29:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169089#M264105</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-08-20T17:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql, output % to 2 decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169090#M264106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Ove tried running the code but now error with this message?&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;85 round(balance/val Denominator,0.00001)*10000 as dtv format=8.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;22&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, *, **, +, ',', -, '.',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LT, LTT, NE, NET, OR, ^=, |, ||, ~=.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2014 09:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169090#M264106</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2014-08-21T09:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql, output % to 2 decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169091#M264107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the first argument to the round function isn't valid.&lt;/P&gt;&lt;P&gt;round(balance/&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;val Denominator&lt;/STRONG&gt;&lt;/SPAN&gt;,0.00001)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;val denominator?&amp;nbsp; Is that two separate variables or a single with a underscore?&lt;/P&gt;&lt;P&gt;As initially indicated your code was not correct to start off with. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2014 14:37:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169091#M264107</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-08-21T14:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql, output % to 2 decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169092#M264108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brandon,&lt;/P&gt;&lt;P&gt;I think Reeza's and Jaap's comments are on point (including checking for bad variables names and the like). Please consider the nature of the comments and don't just copy and paste. The moral of the story is to know how formats work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep in mind that what SAS stores as data is not the same as what you see on the screen in output. You should use FORMAT to control what you see in output (and other output related things), as suggested by others above. Formats can be changed on the fly; defining a format in a dataset is only for convenience. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would avoid using the round function. See below for why you may not want to use the round function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 02:40:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-output-to-2-decimal-places/m-p/169092#M264108</guid>
      <dc:creator>joe00033</dc:creator>
      <dc:date>2014-08-22T02:40:52Z</dc:date>
    </item>
  </channel>
</rss>

