<?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 Round with PROC SQL in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Round-with-PROC-SQL/m-p/531858#M73753</link>
    <description>&lt;P&gt;I am trying to create a new column of batting average and round the column to three decimal places. This is the code I have been trying, but it is returning "0.3" for every value in the Batting Average column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC sql; &lt;BR /&gt; 	SELECT name, team, round (nhits / natbat,0.3) as batavg label="Batting Average"&lt;BR /&gt; 	FROM sashelp.baseball&lt;BR /&gt; 	ORDER BY batavg desc;&lt;/PRE&gt;</description>
    <pubDate>Fri, 01 Feb 2019 01:33:54 GMT</pubDate>
    <dc:creator>Steelersgirl</dc:creator>
    <dc:date>2019-02-01T01:33:54Z</dc:date>
    <item>
      <title>Round with PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Round-with-PROC-SQL/m-p/531858#M73753</link>
      <description>&lt;P&gt;I am trying to create a new column of batting average and round the column to three decimal places. This is the code I have been trying, but it is returning "0.3" for every value in the Batting Average column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC sql; &lt;BR /&gt; 	SELECT name, team, round (nhits / natbat,0.3) as batavg label="Batting Average"&lt;BR /&gt; 	FROM sashelp.baseball&lt;BR /&gt; 	ORDER BY batavg desc;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Feb 2019 01:33:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Round-with-PROC-SQL/m-p/531858#M73753</guid>
      <dc:creator>Steelersgirl</dc:creator>
      <dc:date>2019-02-01T01:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Round with PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Round-with-PROC-SQL/m-p/531859#M73754</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243060"&gt;@Steelersgirl&lt;/a&gt;&amp;nbsp; - I think your problem here is you're misunderstanding how the round function works. The second argument is the rounding unit and not the number of decimal places you want. You can see how this works if you look at the section titled "producing Expected Results" in. this link -&amp;gt;&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0tj6cmga7p8qln1ejh6ebevm0c9.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0tj6cmga7p8qln1ejh6ebevm0c9.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you want is a rounding unit of 0.001 as in the code below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
 	SELECT name, team, round (nhits / natbat,0.001) as batavg label="Batting Average"
 	FROM sashelp.baseball
 	ORDER BY batavg desc;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Feb 2019 01:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Round-with-PROC-SQL/m-p/531859#M73754</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2019-02-01T01:51:59Z</dc:date>
    </item>
  </channel>
</rss>

