<?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 Different date formats in Excel file output in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705963#M26296</link>
    <description>&lt;P&gt;Hi. I have a data set made with proc SQL with a large number of data.&lt;/P&gt;&lt;P&gt;I then exported the data in multiple csv files.&lt;/P&gt;&lt;P&gt;However my output shows different data format.&lt;/P&gt;&lt;P&gt;How can I fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sampledate
01-dec-20
30-nov-20
23-apr-20
24-aug-20
26-sep-20
28-sep-20
26-aug-20
06-sep-20
01-sep-20
16-sep-20
27MAY2020
13OCT2020
18-aug-20
31OCT2020
19MAY2020&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Dec 2020 09:20:52 GMT</pubDate>
    <dc:creator>mmea</dc:creator>
    <dc:date>2020-12-15T09:20:52Z</dc:date>
    <item>
      <title>Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705963#M26296</link>
      <description>&lt;P&gt;Hi. I have a data set made with proc SQL with a large number of data.&lt;/P&gt;&lt;P&gt;I then exported the data in multiple csv files.&lt;/P&gt;&lt;P&gt;However my output shows different data format.&lt;/P&gt;&lt;P&gt;How can I fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sampledate
01-dec-20
30-nov-20
23-apr-20
24-aug-20
26-sep-20
28-sep-20
26-aug-20
06-sep-20
01-sep-20
16-sep-20
27MAY2020
13OCT2020
18-aug-20
31OCT2020
19MAY2020&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 09:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705963#M26296</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2020-12-15T09:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705964#M26297</link>
      <description>&lt;P&gt;How did you do the export?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 09:24:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705964#M26297</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-12-15T09:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705967#M26299</link>
      <description>&lt;P&gt;IMO, this can only happen (in a simple export) if these "dates" are in fact inconsistently formatted strings in character variables, and not SAS date values.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 09:34:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705967#M26299</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-15T09:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705968#M26300</link>
      <description>&lt;P&gt;data dataset;&lt;BR /&gt;set dataset;&lt;BR /&gt;ID = _n_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;set datasetnobs=n;&lt;BR /&gt;call symputx('antal_gange', ceil(n/1000000));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data export;&lt;BR /&gt;set dataset;&lt;BR /&gt;if 1000000&amp;lt;=_n_&amp;lt;2*1000000;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%macro dummy();&lt;/P&gt;&lt;P&gt;%do i=1 %to &amp;amp;antal_gange ;&lt;/P&gt;&lt;P&gt;data export;&lt;BR /&gt;set dataset;&lt;BR /&gt;if (&amp;amp;i-1)*1000000&amp;lt;_n_&amp;lt;=&amp;amp;i*1000000;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc export data=export&lt;BR /&gt;replace&lt;BR /&gt;outfile="F:\DATA_&amp;amp;i..csv"&amp;nbsp;&lt;BR /&gt;dbms=dlm&lt;BR /&gt;;&lt;BR /&gt;delimiter=';';&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%dummy();&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 09:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705968#M26300</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2020-12-15T09:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705969#M26301</link>
      <description>&lt;P&gt;in the dataset in SAS when I view the table, it does not show different formats of dates, all are the same. It is only when I export til excel.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 09:39:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705969#M26301</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2020-12-15T09:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705972#M26303</link>
      <description>&lt;P&gt;Please post an example of your dataset in a data step with datalines, make sure that this data step creates an excerpt identical to your dataset in terms of content and attributes. Also post the code you used to export your data to Excel.&lt;/P&gt;
&lt;P&gt;We need this to be able to recreate your issue in our environments.&lt;/P&gt;
&lt;P&gt;Post all the code by copy/pasting it into a window opened with the "little running man" button right next to the one indicated here:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg"&gt;&lt;img src="https://communities.sas.com/skins/images/8D8B612AA6AB1DC7E9A0812281D56E02/responsive_peak/images/image_not_found.png" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The indicated button is the one to use for logs and text data.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 09:45:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705972#M26303</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-15T09:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705973#M26304</link>
      <description>&lt;P&gt;Inspect the contents of your CSV files with a text editor before opening them with Excel. Excel will show you what it&amp;nbsp;&lt;EM&gt;thinks&lt;/EM&gt; is in the data, and Excel is not good at doing that. But the actual contents of the files might give us (and you) a hint how to do the export in a consistent manner. In particular, which formats to set for the date variables so that Excel can consistently recognize them as dates. Since this is also dependent on your locale, please tell us how that is set on your Excel computer.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 09:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705973#M26304</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-15T09:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705974#M26305</link>
      <description>&lt;P&gt;/&lt;CODE class=" language-sas"&gt;*Dataset created*/&lt;/CODE&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql;
   create table Data as
   select *
   from connection to XX(
      select sampleDate, XX,XX
      from [XX].[XX].[XX]  with(nolock)
	  where XX= 710
   );
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;then i do this for exporting&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dataset;
set dataset;
ID = _n_;
run;


data _null_;
set datasetnobs=n;
call symputx('antal_gange', ceil(n/1000000));
run;


data export;
set dataset;
if 1000000&amp;lt;=_n_&amp;lt;2*1000000;
run;

%macro dummy();

%do i=1 %to &amp;amp;antal_gange ;

data export;
set dataset;
if (&amp;amp;i-1)*1000000&amp;lt;_n_&amp;lt;=&amp;amp;i*1000000;
run;


proc export data=export
replace
outfile="F:\dataset_&amp;amp;i..csv" 
  dbms=dlm
;
delimiter=';';
quit;

%end;

%mend;

%dummy();

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Dec 2020 09:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705974#M26305</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2020-12-15T09:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705975#M26306</link>
      <description>&lt;P&gt;i tried open the CSV file in textedit file, and the date shows the same format for all: e.g. "01JAN2020".&lt;/P&gt;&lt;P&gt;But if i open the csv in excel then it will change to another format as showed before.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 10:01:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705975#M26306</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2020-12-15T10:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705979#M26308</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353472"&gt;@mmea&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;i tried open the CSV file in textedit file, and the date shows the same format for all: e.g. "01JAN2020".&lt;/P&gt;
&lt;P&gt;But if i open the csv in excel then it will change to another format as showed before.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Ok.&lt;BR /&gt;&lt;STRONG&gt;BIG HINT&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;Do NOT use the DATE9. format for anything that has to go outside SAS. AFAIK, this format is only used (as a default) in SAS, and no other software (that I know of). Use a format that is very clearly understood to be a date, like YYMMDD10.&lt;/P&gt;
&lt;P&gt;Or a format that correlates to the default format that Excel uses when you enter a date there (as already said, this is dependent on your locale).&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 10:32:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705979#M26308</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-15T10:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705986#M26310</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a way to change the format directly in the proc sql statment?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table DATA as
      select p.sampledate
      from [IB_Outbreak].[SARS2].[PatientLineListe_V2] as p 
	  where XXXXX
   );
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Dec 2020 11:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705986#M26310</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2020-12-15T11:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Different date formats in Excel file output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705995#M26313</link>
      <description>&lt;P&gt;Use a FORMAT= option in the SELECT:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table DATA as
      select p.sampledate format=yymmdd10.
      from [IB_Outbreak].[SARS2].[PatientLineListe_V2] as p 
	  where XXXXX
   );
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that your code will throw an ERROR for the surplus closing bracket.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 12:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-date-formats-in-Excel-file-output/m-p/705995#M26313</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-15T12:12:01Z</dc:date>
    </item>
  </channel>
</rss>

