<?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: Show result numbers with two decimal places in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791357#M253466</link>
    <description>&lt;P&gt;Hi thanks for your answer&lt;/P&gt;
&lt;P&gt;This is part my code with proc sgl:&lt;/P&gt;
&lt;PRE&gt;proc sql;
    create table COREP_CR_&amp;amp;gv_tbl_date as
	select distinct
	a.DATA_DANYCH as REPORTING_DATE,
	"" as ID,
	    sum(a.EXP_PIERWOTNA_NETTO) as  EAD_PRE_CCF,
            sum(a.KOREKTA) as  PROVISION,
from corep
;
quit;&lt;/PRE&gt;
&lt;P&gt;This is my code to export to excel :&lt;/P&gt;
&lt;PRE&gt;proc export data=COREP_CR_&amp;amp;gv_tbl_date
            outfile="&amp;amp;glb_path2./reports/mth_ak/COREP_CR_&amp;amp;gv_tbl_date..xlsx"
            dbms=xlsx
            replace;
            sheet="corep_cr";
run; 
&lt;/PRE&gt;</description>
    <pubDate>Fri, 21 Jan 2022 09:00:42 GMT</pubDate>
    <dc:creator>Gieorgie</dc:creator>
    <dc:date>2022-01-21T09:00:42Z</dc:date>
    <item>
      <title>Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791085#M253332</link>
      <description>&lt;P&gt;I would like to show in the final table that I export to Excel numbers that have 2 decimal places, not 6 or 7. I tried by &lt;/P&gt;
&lt;PRE&gt;sum(a.EXP_PIERWOTNA_NETTO) as  EAD_PRE_CCF format _numeric_ 9.3,&lt;/PRE&gt;
&lt;P&gt;but isn't work. What is the best solution in this case ?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 08:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791085#M253332</guid>
      <dc:creator>Gieorgie</dc:creator>
      <dc:date>2022-01-20T08:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791089#M253334</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format=9.2&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The _numeric_ is an automatically created macro variable for all numeric variables, mostly used in an array statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;leave it and put a "=" between the format call and the specific format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;put 9.2 if you want 2 decimal places&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 08:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791089#M253334</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-01-20T08:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791091#M253335</link>
      <description>&lt;PRE&gt;Hi, i did but still same nothing change sum(a.EXP_PIERWOTNA_NETTO) as EAD_PRE_CCF format = 9.2,&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jan 2022 08:43:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791091#M253335</guid>
      <dc:creator>Gieorgie</dc:creator>
      <dc:date>2022-01-20T08:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791093#M253337</link>
      <description>&lt;P&gt;I suppose it's a snippet from a sql statement. Please show the complete code and verify that&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;EXP_PIERWOTNA_NETTO&lt;/PRE&gt;
&lt;P&gt;is a numeric variable&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 08:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791093#M253337</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-01-20T08:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791094#M253338</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select make, mean(horsepower) as avg_hp format=9.2 from 
sashelp.cars group by make;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;that works&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 08:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791094#M253338</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-01-20T08:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791100#M253343</link>
      <description>&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;ALWAYS&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="4"&gt; &lt;FONT size="3"&gt;show us the &lt;U&gt;whole&lt;/U&gt; log of your code when something does not work as expected; in your case, also include the code that transfers the data to Excel.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 09:36:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791100#M253343</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-01-20T09:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791111#M253347</link>
      <description>&lt;P&gt;I do not think Excel will show the number of decimals that are transferred from SAS - if you enter e.g. "1.00" in Excel it will just show a "1". You should probably select the column in Excel and set the number of decimals there ("Format Cells").&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 10:55:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791111#M253347</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2022-01-20T10:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791194#M253377</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/401093"&gt;@Gieorgie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I would like to show in the final table that I export to Excel numbers that have 2 decimal places, not 6 or 7. I tried by&lt;/P&gt;
&lt;PRE&gt;sum(a.EXP_PIERWOTNA_NETTO) as  EAD_PRE_CCF format _numeric_ 9.3,&lt;/PRE&gt;
&lt;P&gt;but isn't work. What is the best solution in this case ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You really need to show exactly how you create Excel from SAS. Many approaches leave the display of resulting values to default behavior of Excel, which is extremely likely to not be what you want. For example, if you use Proc Export then values are passed to the result, no formatting of any type is provided from SAS and everything is open to Excel interpretation.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 16:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791194#M253377</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-01-20T16:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791357#M253466</link>
      <description>&lt;P&gt;Hi thanks for your answer&lt;/P&gt;
&lt;P&gt;This is part my code with proc sgl:&lt;/P&gt;
&lt;PRE&gt;proc sql;
    create table COREP_CR_&amp;amp;gv_tbl_date as
	select distinct
	a.DATA_DANYCH as REPORTING_DATE,
	"" as ID,
	    sum(a.EXP_PIERWOTNA_NETTO) as  EAD_PRE_CCF,
            sum(a.KOREKTA) as  PROVISION,
from corep
;
quit;&lt;/PRE&gt;
&lt;P&gt;This is my code to export to excel :&lt;/P&gt;
&lt;PRE&gt;proc export data=COREP_CR_&amp;amp;gv_tbl_date
            outfile="&amp;amp;glb_path2./reports/mth_ak/COREP_CR_&amp;amp;gv_tbl_date..xlsx"
            dbms=xlsx
            replace;
            sheet="corep_cr";
run; 
&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jan 2022 09:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791357#M253466</guid>
      <dc:creator>Gieorgie</dc:creator>
      <dc:date>2022-01-21T09:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791397#M253479</link>
      <description>&lt;P&gt;If adding&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format=20.2&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to your variables in the SQL step does not fix it, then the next step is using ODS EXCEL and a reporting procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that your SQL might not create your intended result, as you calculate the total sums over the whole dataset and have these identical values in every combination of date/id. Did you miss to use a GROUP BY clause?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 12:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791397#M253479</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-01-21T12:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791428#M253494</link>
      <description>I have a group, as I said, the code itself has 300 lines, so I did not put the ending sorry. So I understand I should add the format = 10.2 and then create the ODS EXCEL procedure?</description>
      <pubDate>Fri, 21 Jan 2022 14:11:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791428#M253494</guid>
      <dc:creator>Gieorgie</dc:creator>
      <dc:date>2022-01-21T14:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791429#M253495</link>
      <description>&lt;P&gt;Ok, im trying to do like ODS EXCEL, when it generates the file it is created but empty&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ods excel file = "&amp;amp;glb_path2./reports/mth_ak/COREP_CR_&amp;amp;gv_tbl_date..xlsx";  
proc print data=COREP_CR_&amp;amp;gv_tbl_date;

ods excel close;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jan 2022 14:18:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791429#M253495</guid>
      <dc:creator>Gieorgie</dc:creator>
      <dc:date>2022-01-21T14:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Show result numbers with two decimal places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791553#M253563</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/401093"&gt;@Gieorgie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Ok, im trying to do like ODS EXCEL, when it generates the file it is created but empty&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ods excel file = "&amp;amp;glb_path2./reports/mth_ak/COREP_CR_&amp;amp;gv_tbl_date..xlsx";  
proc print data=COREP_CR_&amp;amp;gv_tbl_date;

ods excel close;
&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have no RUN statement to create a step boundary, and global statements (like ODS) are executed immediately when encountered, so the Excel destination is closed before PROC PRINT writes any output to it.&lt;/P&gt;
&lt;P&gt;See Maxim 49.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 18:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-result-numbers-with-two-decimal-places/m-p/791553#M253563</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-01-21T18:22:47Z</dc:date>
    </item>
  </channel>
</rss>

