Desktop productivity for business analysts and programmers

Different format date when export to csv file

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Different format date when export to csv file

Hi All,

I'm having a trouble to keep my date format after exporting to csv.

I'm generating date using the following format yyyy-mm-dd but when i open the exported csv file it gives me : dd/mm/yyyy.

 

I'm using the SAS EG version 7.13 HF3   : Task/Data/Copy files feature to export.

 

so,please any help will be appreciated.

Thanks

 


Accepted Solutions
Solution
‎02-17-2017 11:07 AM
Super User
Posts: 11,134

Re: Different format date when export to csv file


korssane wrote:

Hi ,

Thanks for the quick reply .

I'm opening the file using Excel. 

the actual SAS format name of the variable(s) in the dataset

Type : Date 

length : 8

Format : YYMMDD10.

Informat is blank 

 

pls let me know if you need other info.

thanks

 

 


Did you try opening it in another application such as Notepad or Wordpad? If you use one of these then you'll likely see dates is yyyy-mm-dd appearance.

 

I repeat: Excel will change the appearance of values. One option is to not worry about it and just the column appearance in Excel using the format cells for the entire  column.

 

View solution in original post


All Replies
Super User
Posts: 11,134

Re: Different format date when export to csv file

Did you open the result in Excel or a text editor? Excel is infamous for reformatting things.

 

You may have to tell  us the actual SAS format name of the variable(s) in the dataset if the above is not the case.

New Contributor
Posts: 2

Re: Different format date when export to csv file

Hi ,

Thanks for the quick reply .

I'm opening the file using Excel. 

the actual SAS format name of the variable(s) in the dataset

Type : Date 

length : 8

Format : YYMMDD10.

Informat is blank 

 

pls let me know if you need other info.

thanks

 

 

Solution
‎02-17-2017 11:07 AM
Super User
Posts: 11,134

Re: Different format date when export to csv file


korssane wrote:

Hi ,

Thanks for the quick reply .

I'm opening the file using Excel. 

the actual SAS format name of the variable(s) in the dataset

Type : Date 

length : 8

Format : YYMMDD10.

Informat is blank 

 

pls let me know if you need other info.

thanks

 

 


Did you try opening it in another application such as Notepad or Wordpad? If you use one of these then you'll likely see dates is yyyy-mm-dd appearance.

 

I repeat: Excel will change the appearance of values. One option is to not worry about it and just the column appearance in Excel using the format cells for the entire  column.

 

Super User
Posts: 7,433

Re: Different format date when export to csv file

Excel is the culprit here. At least it recognized your dates as such.

Excel will format dates according to the Windows locale setting.

After opening the file, change the format for the column to the one you desire. Or change the system's date format setting.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 386 views
  • 5 likes
  • 3 in conversation