<?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: Keep trailing zeros in csv file after using ROUND function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564351#M158289</link>
    <description>&lt;P&gt;For a simple task such as writing a CSV file, put &lt;STRONG&gt;proc export&lt;/STRONG&gt; to work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
format weight 7.2;
run;

PROC EXPORT DATA= WORK.CLASS 
            OUTFILE= "&amp;amp;sasforum\reports\csvtest.csv" 
            DBMS=CSV REPLACE;
     PUTNAMES=YES;
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Name,Sex,Age,Height,Weight
Alfred,M,14,69,112.50
Alice,F,13,56.5,84.00
Barbara,F,13,65.3,98.00
Carol,F,14,62.8,102.50
Henry,M,14,63.5,102.50
James,M,12,57.3,83.00
Jane,F,12,59.8,84.50
Janet,F,15,62.5,112.50
Jeffrey,M,13,62.5,84.00
John,M,12,59,99.50
Joyce,F,11,51.3,50.50
Judy,F,14,64.3,90.00
Louise,F,12,56.3,77.00
Mary,F,15,66.5,112.00
Philip,M,16,72,150.00
Robert,M,12,64.8,128.00
Ronald,M,15,67,133.00
Thomas,M,11,57.5,85.00
William,M,15,66.5,112.00
&lt;/PRE&gt;</description>
    <pubDate>Fri, 07 Jun 2019 03:28:20 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2019-06-07T03:28:20Z</dc:date>
    <item>
      <title>Keep trailing zeros in csv file after using ROUND function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564322#M158277</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset that I would like to output in a csv file after rounding the average of a variable to one decimal place. I also would like whole numbers to appear like this '10.0'. I used a format in my SAS dataset to ensure that whole numbers would keep that trailing zero, but when I export out into a csv file, the trailing zeros are lost.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can ensure that the trailing zeros won't be lost once it is converted into a csv file. I am using proc report to generate my csv file.&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;&lt;P&gt;data all2;&lt;BR /&gt;set all1;&lt;BR /&gt;avg=round(average,0.1);&lt;BR /&gt;format avg 5.1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%let rptfile=Average;&lt;BR /&gt;%let outpath=\\desktop\;&lt;BR /&gt;ODS _ALL_ CLOSE;&lt;BR /&gt;ods csv file = "&amp;amp;outpath.&amp;amp;rptfile..csv"&lt;BR /&gt;options ( SHEET_NAME="Report"&lt;BR /&gt;AUTOFILTER = "all"&lt;BR /&gt;EMBEDDED_TITLES ="yes"&lt;BR /&gt;ORIENTATION ="landscape"&lt;BR /&gt;frozen_headers='3'&lt;BR /&gt;absolute_column_width='8, 10, 16, 12'&lt;BR /&gt;) ;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;title2 "Report Generated";&lt;BR /&gt;&lt;BR /&gt;proc report data=all2 nowd split="~"&lt;BR /&gt;style(Header)=[just=left font_weight=bold font_size=10pt]&lt;BR /&gt;style(column)={just=left vjust=center font_size=10pt font_face=times background=white foreground=black bordercolor=black};&lt;BR /&gt;columns subnum avg ;&lt;BR /&gt;define subject/"Subject";&lt;BR /&gt;define avg/"Average";&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;ods excel close;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 22:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564322#M158277</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-06-06T22:35:37Z</dc:date>
    </item>
    <item>
      <title>Keep trailing zeros in csv file after using ROUND Function for sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564334#M158296</link>
      <description>&lt;P&gt;Hi, I posted this question in SAS programming, but thought it would fit better here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset that I would like to output in a csv file after rounding the average of a variable to one decimal place. I also would like whole numbers to appear like this '10.0'. I used a format in my SAS dataset to ensure that whole numbers would keep that trailing zero, but when I export out into a csv file, the trailing zeros are lost.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can ensure that the trailing zeros won't be lost once it is converted into a csv file. I am using proc report to generate my csv file.&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;&lt;P&gt;data all2;&lt;BR /&gt;set all1;&lt;BR /&gt;avg=round(average,0.1);&lt;BR /&gt;format avg 5.1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%let rptfile=Average;&lt;BR /&gt;%let outpath=\\desktop\;&lt;BR /&gt;ODS _ALL_ CLOSE;&lt;BR /&gt;ods csv file = "&amp;amp;outpath.&amp;amp;rptfile..csv"&lt;BR /&gt;options ( SHEET_NAME="Report"&lt;BR /&gt;AUTOFILTER = "all"&lt;BR /&gt;EMBEDDED_TITLES ="yes"&lt;BR /&gt;ORIENTATION ="landscape"&lt;BR /&gt;frozen_headers='3'&lt;BR /&gt;absolute_column_width='8, 10, 16, 12'&lt;BR /&gt;) ;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;title2 "Report Generated";&lt;BR /&gt;&lt;BR /&gt;proc report data=all2 nowd split="~"&lt;BR /&gt;style(Header)=[just=left font_weight=bold font_size=10pt]&lt;BR /&gt;style(column)={just=left vjust=center font_size=10pt font_face=times background=white foreground=black bordercolor=black};&lt;BR /&gt;columns subnum avg ;&lt;BR /&gt;define subject/"Subject";&lt;BR /&gt;define avg/"Average";&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;ods excel close;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 00:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564334#M158296</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-06-07T00:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Keep trailing zeros in csv file after using ROUND Function for sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564335#M158297</link>
      <description>&lt;P&gt;Examine your CSV file in a text editor, not Excel as it has a default action of not showing decimals if they are zero. If the CSV genuinely has the decimal places using say Notepad, then you can blame Excel.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 00:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564335#M158297</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-06-07T00:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Keep trailing zeros in csv file after using ROUND function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564337#M158283</link>
      <description>&lt;P&gt;Your code looks very mixed up.&amp;nbsp; You have a ODS CLOSE for EXCEL destination, but the OPEN is for CSV destination.&lt;/P&gt;
&lt;P&gt;You also have OPTIONS that might be valid for the EXCEL destination, but have no meaning for a CSV file.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 01:10:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564337#M158283</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-07T01:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Keep trailing zeros in csv file after using ROUND function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564351#M158289</link>
      <description>&lt;P&gt;For a simple task such as writing a CSV file, put &lt;STRONG&gt;proc export&lt;/STRONG&gt; to work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
format weight 7.2;
run;

PROC EXPORT DATA= WORK.CLASS 
            OUTFILE= "&amp;amp;sasforum\reports\csvtest.csv" 
            DBMS=CSV REPLACE;
     PUTNAMES=YES;
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Name,Sex,Age,Height,Weight
Alfred,M,14,69,112.50
Alice,F,13,56.5,84.00
Barbara,F,13,65.3,98.00
Carol,F,14,62.8,102.50
Henry,M,14,63.5,102.50
James,M,12,57.3,83.00
Jane,F,12,59.8,84.50
Janet,F,15,62.5,112.50
Jeffrey,M,13,62.5,84.00
John,M,12,59,99.50
Joyce,F,11,51.3,50.50
Judy,F,14,64.3,90.00
Louise,F,12,56.3,77.00
Mary,F,15,66.5,112.00
Philip,M,16,72,150.00
Robert,M,12,64.8,128.00
Ronald,M,15,67,133.00
Thomas,M,11,57.5,85.00
William,M,15,66.5,112.00
&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jun 2019 03:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564351#M158289</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-06-07T03:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Keep trailing zeros in csv file after using ROUND Function for sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564362#M158298</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139341"&gt;@kmardinian&lt;/a&gt;&amp;nbsp; Please don't post one question multiple times. I have merged both posts, to reduce fragmentation.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 05:07:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-trailing-zeros-in-csv-file-after-using-ROUND-function/m-p/564362#M158298</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-06-07T05:07:44Z</dc:date>
    </item>
  </channel>
</rss>

