<?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: formatting for less than 1 percent in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242739#M45079</link>
    <description>&lt;P&gt;Yeah, I am trying that too.&amp;nbsp; Still rounding up to 1.&amp;nbsp; Here is the exression I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ROUND((COUNT(t1.DEL30))/(COUNT(t1.LOAN_NUM)),0.0001)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The numbers in this expression are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ROUND((35/14824),0.0001)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;35/14824 = 0.0023610361575823&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jan 2016 16:09:26 GMT</pubDate>
    <dc:creator>elwayfan446</dc:creator>
    <dc:date>2016-01-11T16:09:26Z</dc:date>
    <item>
      <title>formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242716#M45073</link>
      <description>&lt;P&gt;I am having trouble keeping values of less than 1 percent from rounding to 1.&amp;nbsp; Can you tell me what I am missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need this number to 0.0023610361575823 only round to 0.0024 at the most.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242716#M45073</guid>
      <dc:creator>elwayfan446</dc:creator>
      <dc:date>2016-01-11T15:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242717#M45074</link>
      <description>&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p0tj6cmga7p8qln1ejh6ebevm0c9.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p0tj6cmga7p8qln1ejh6ebevm0c9.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:28:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242717#M45074</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2016-01-11T15:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242719#M45075</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp; I found that article and tried a few of them and they are still rounding to 1.&amp;nbsp; I tried this specifically thinking it would be the one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;d7 = round(1234.56789,.0001) - 1234.5679;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:34:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242719#M45075</guid>
      <dc:creator>elwayfan446</dc:creator>
      <dc:date>2016-01-11T15:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242732#M45077</link>
      <description>&lt;P&gt;What FORMAT is used display the variable? Run Proc Contents or use the table column view to examine variable properties. If the format tells SAS to display fewer decimal points then you want that's all that appear. You may to assign a format like F10.6&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242732#M45077</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-11T15:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242734#M45078</link>
      <description>&lt;P&gt;The ROUND function has a second argument that specifies the unit of rounding.&amp;nbsp; To round to the nearest 0.001, call it as&lt;/P&gt;
&lt;P&gt;r = round( 0.0023610361575823, 0.0001);&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the example near the end of the article &lt;A href="http://blogs.sas.com/content/iml/2011/10/03/rounding-up-rounding-down.html" target="_self"&gt;"Rounding Up, Rounding Down."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:56:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242734#M45078</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-01-11T15:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242739#M45079</link>
      <description>&lt;P&gt;Yeah, I am trying that too.&amp;nbsp; Still rounding up to 1.&amp;nbsp; Here is the exression I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ROUND((COUNT(t1.DEL30))/(COUNT(t1.LOAN_NUM)),0.0001)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The numbers in this expression are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ROUND((35/14824),0.0001)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;35/14824 = 0.0023610361575823&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242739#M45079</guid>
      <dc:creator>elwayfan446</dc:creator>
      <dc:date>2016-01-11T16:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242740#M45080</link>
      <description>&lt;P&gt;So, if you run the code:&lt;/P&gt;
&lt;PRE&gt;data tmp;
  a=ROUND((35/14824),0.0001);
run;
  &lt;/PRE&gt;
&lt;P&gt;Your saying that you don't get a being 0.0024? &amp;nbsp;I would suggest then its a SAS helpdesk issue as it works fine on my machine. &amp;nbsp;However it looks to me like your using SQL there. &amp;nbsp;Please post, some test data as a datastep, and the exact full code you are running so that I can replicate the issue on my machine.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:16:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242740#M45080</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-01-11T16:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242741#M45081</link>
      <description>&lt;P&gt;Do you store&amp;nbsp;the result of&amp;nbsp;this SQL expression in a variable?&amp;nbsp;(And why do you refer to "percent"?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, let's say you have a numeric variable which contains the value &lt;SPAN&gt;0.0023610361575823. Now you could either round this value to four decimals or simply apply a format to achieve the same displayed result of 0.0024:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
x=0.0023610361575823;
rx=round(x,.0001);
put rx;
put x 6.4;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;The format approach (see the second PUT statement above, using format 6.4) has the advantage that you don't have to create a new variable to hold the rounded value (rx in the example above), let alone to overwrite your existing value with a less precise one.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your second example, you define variable d7&amp;nbsp;to have the value 0, because the ROUND function returns exactly the value you subtract from it.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:20:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242741#M45081</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-01-11T16:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242742#M45082</link>
      <description>&lt;P&gt;I am creating an advanced expression field in Enterprise Guide 6.1 with the following expression:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ROUND((COUNT(t1.DEL30))/(COUNT(t1.LOAN_NUM)),0.0001)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The values of thouse count functions are 35/14824 and the results I get are&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12180i1FF3D6F382CB8A60/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Capture.JPG" title="Capture.JPG" /&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242742#M45082</guid>
      <dc:creator>elwayfan446</dc:creator>
      <dc:date>2016-01-11T16:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242745#M45084</link>
      <description>&lt;P&gt;Again, what FORMAT is the variable using to display values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have a value of 0.00024 and display it with a Percent6.1 the Displayed value is 0.0%, with Percent10.4 0.0240%, best1. shows 0, best4. shows 0, F4.1 shows 0.0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have custome formats that cold display a value that small as "&amp;lt;0.05". The format could well be assigning ANY value between 0 and 1 as 1 and have very little with how you are getting the actual numeric value.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:37:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242745#M45084</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-11T16:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242746#M45085</link>
      <description>&lt;P&gt;Ah, so your using EG, its generally a good idea to post in the relevant sub forum. &amp;nbsp;I don't use EG, but I would guess, for what you have posted and what you show there, that it is the format on the PERCENTDELQLOANCOUNT is hiding the actual value. &amp;nbsp;As I said, I don't use EG, but in Base SAS, after an SQL expression like that you can specify the format:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ROUND((COUNT(t1.DEL30))/(COUNT(t1.LOAN_NUM)),0.000&lt;/SPAN&gt;&lt;WBR /&gt;&lt;SPAN&gt;1) as&amp;nbsp;PERCENTDELQLOANCOUNT format=8.4&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Don't know how you would do the same in this "advanced expression field" maybe there is an option for it on column properties?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242746#M45085</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-01-11T16:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242752#M45089</link>
      <description>&lt;P&gt;Are you sure that the subexpressions are 35 and 14824? The COUNT function returns the number of nonmissing values in a column.&amp;nbsp; Perhaps you are using zeros for the del30 variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is data that shows the issue:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
do i = 1 to 35;
   del30 = 1; Loan_NUM=i; output;
end;
do i = 36 to 14824;
   del30 = .; Loan_NUM=i; output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you define a new variable by using use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;round( count(del30) / count(Loan_NUM), 0.0001)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you will get 0.0024, as expected. However, if you have 0 instead of missing for the del30 variable, then the expression will evaluate to 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242752#M45089</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-01-11T16:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242756#M45092</link>
      <description>&lt;P&gt;Correct, you specify that on the column properties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for not posting this in the EG forum.&amp;nbsp; I was thinking it was a simple SAS format issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ballard, I have tried different put formats.&amp;nbsp; Currently the format I am using is 6.4 and it is showing as 1.0000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1411iCD7847D361655695/image-size/original?v=mpbl-1&amp;amp;px=-1" alt="Capture.JPG" title="Capture.JPG" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:48:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242756#M45092</guid>
      <dc:creator>elwayfan446</dc:creator>
      <dc:date>2016-01-11T16:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242759#M45093</link>
      <description>&lt;P&gt;Rick, yes, there are 0 values in the data, not missing values.&amp;nbsp; However, in my sql expression to get the counts, I use a where clause to exclude observations that are 0.&amp;nbsp; where DEL30 &amp;lt;&amp;gt; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The results....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1412i94D36A3632298428/image-size/original?v=mpbl-1&amp;amp;px=-1" alt="Capture.JPG" title="Capture.JPG" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242759#M45093</guid>
      <dc:creator>elwayfan446</dc:creator>
      <dc:date>2016-01-11T16:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242761#M45094</link>
      <description>&lt;P&gt;Rick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After thinking about your reply a little bit more... I figured it out.&amp;nbsp; In Enterprise Guide, I was using the advanced expression variable that I had created to get the counts originally instead of using the expression that I used to get it.&amp;nbsp; So, it was not using the where DEL30 &amp;lt;&amp;gt; 0 criteria that the original variable was using.&amp;nbsp; I had to literally write it again for the new variable and it worked.&amp;nbsp; So...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of (which were the original calculated variables)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;del30&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;Loan_NUM&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt; &lt;/PRE&gt;&lt;P&gt;I had to use the criteria to get the count in the new variable:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;(SELECT
       COUNT(LOAN_NUM) 
FROM MSRADHOC.MSR_2015_ONBOOK_DELQ
WHERE DEL30 &amp;lt;&amp;gt; 0)/(COUNT(t1.LOAN_NUM))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you for triggering the thought process on this.&amp;nbsp; I appreciate everyone's help this morning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 17:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242761#M45094</guid>
      <dc:creator>elwayfan446</dc:creator>
      <dc:date>2016-01-11T17:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: formatting for less than 1 percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242769#M45097</link>
      <description>&lt;P&gt;Or if DEL30 is a binary variable, you can just use SUM(DEL30).&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 17:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-for-less-than-1-percent/m-p/242769#M45097</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-01-11T17:49:04Z</dc:date>
    </item>
  </channel>
</rss>

