<?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: Different format date when export to csv file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243048#M45179</link>
    <description>&lt;P&gt;you are right.&lt;/P&gt;
&lt;P&gt;when I run Proc contents, it showed the date has an "informat" as date9 and format as mmddyy8 at the same time.&lt;/P&gt;
&lt;P&gt;so I removed the informat, and it works!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for your effort to help, I appreciate your time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a great day and Happy New Year!&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jan 2016 20:36:11 GMT</pubDate>
    <dc:creator>ursula</dc:creator>
    <dc:date>2016-01-12T20:36:11Z</dc:date>
    <item>
      <title>Different format date when export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/242999#M45146</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I did date format as mmddyy8. (01/01/16 -- with 2 digits year) &amp;nbsp;in SAS, but when I exported to csv file, the format of the date changed to 4 digits year, and it also showed 4 digits year when I opened the csv file with Notepad.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is there a way to keep the date format as mmddyy8. (with 2 digits year) when export to csv file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example:&lt;/P&gt;
&lt;P&gt;Date in SAS = 01/01/16, when export to csv file, I want the date format same as the format in SAS -- 01/01/16 in csv file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 18:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/242999#M45146</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2016-01-12T18:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Different format date when export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243001#M45148</link>
      <description>&lt;P&gt;Please show the code you used to export to CSV. There are a number of different ways to create a CSV file and the solution to the format issue may change depending on your choice.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 18:27:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243001#M45148</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-12T18:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Different format date when export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243002#M45149</link>
      <description>How are you exporting the data? When writing a CSV SAS honours formats applied usually, so you shouldn't have to change anything.</description>
      <pubDate>Tue, 12 Jan 2016 18:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243002#M45149</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-12T18:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Different format date when export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243006#M45153</link>
      <description>&lt;P&gt;I was using this code to export the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC EXPORT DATA=test DBMS=CSV&lt;BR /&gt;FILE='test.csv';run;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 18:33:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243006#M45153</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2016-01-12T18:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Different format date when export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243009#M45156</link>
      <description>&lt;P&gt;I can't replicate your issue with SAS 9.3 and proc export. Make sure the format is applied to your dataset, you can confirm this with a proc contents on your data set. Does the following generate a file with the two digit years for you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
do i=1 to 12;
test_date=mdy(i, 20, 2016);
output;
end;
format test_date mmddyy8.;
run;

proc export data=test outfile='c:\_localdata\delete.csv' dbms=csv replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jan 2016 18:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243009#M45156</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-12T18:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Different format date when export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243026#M45164</link>
      <description>&lt;P&gt;I run&amp;nbsp;the code from you.&lt;/P&gt;
&lt;P&gt;it showed 4 digits year if opened it in excel file.&lt;/P&gt;
&lt;P&gt;But it showed 2 digets year when opened it in notepad, which is perfect!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your review,&lt;/P&gt;
&lt;P&gt;I used this format in my code.&lt;/P&gt;
&lt;P&gt;PROC FORMAT;&lt;BR /&gt;VALUE&amp;nbsp;test&lt;BR /&gt;-9="-9"&lt;BR /&gt;-1="-1"&lt;BR /&gt;0-HIGH=[MMDDYY8.];RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set datahave;&lt;/P&gt;
&lt;P&gt;format date test.;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC EXPORT DATA=want&amp;nbsp;DBMS=CSV&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FILE= “want.&lt;EM&gt;csv&lt;/EM&gt;”;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the date changed to 4 digits year.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 19:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243026#M45164</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2016-01-12T19:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Different format date when export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243036#M45170</link>
      <description>&lt;P&gt;I run&amp;nbsp;the code from you.&lt;/P&gt;
&lt;P&gt;it showed 4 digits year if opened it in excel file.&lt;/P&gt;
&lt;P&gt;But it showed 2 digets year when opened it in notepad, which is perfect!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your review,&lt;/P&gt;
&lt;P&gt;I used this format in my code.&lt;/P&gt;
&lt;P&gt;PROC FORMAT;&lt;BR /&gt;VALUE&amp;nbsp;test&lt;BR /&gt;-9="-9"&lt;BR /&gt;-1="-1"&lt;BR /&gt;0-HIGH=[MMDDYY8.];RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set datahave;&lt;/P&gt;
&lt;P&gt;format date test.;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC EXPORT DATA=want&amp;nbsp;DBMS=CSV&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FILE= “want.&lt;EM&gt;csv&lt;/EM&gt;”;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the date changed to 4 digits year in csv file (open in ecxcel or notepad).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 19:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243036#M45170</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2016-01-12T19:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Different format date when export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243045#M45176</link>
      <description>&lt;P&gt;Post your log from that code please, as well as the output from a proc contents on your actual dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc contents data=want;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given that my code worked, its likely something incorrect in your process - one may be not having replace specified so that your new file isn't atually being created. Or the format isn't applied correctly to the want dataset. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 20:30:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243045#M45176</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-12T20:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Different format date when export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243048#M45179</link>
      <description>&lt;P&gt;you are right.&lt;/P&gt;
&lt;P&gt;when I run Proc contents, it showed the date has an "informat" as date9 and format as mmddyy8 at the same time.&lt;/P&gt;
&lt;P&gt;so I removed the informat, and it works!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for your effort to help, I appreciate your time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a great day and Happy New Year!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 20:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-date-when-export-to-csv-file/m-p/243048#M45179</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2016-01-12T20:36:11Z</dc:date>
    </item>
  </channel>
</rss>

