BookmarkSubscribeRSS Feed
boey
Calcite | Level 5


I am having a problem of date output format when sending my list report to excel, the date format originally set in SAS EG has changed from DD/MM/YYYY to mixure of DD/MM/YYYY and MM/DD/YYYY. Any solution for this?

10 REPLIES 10
TomKari
Onyx | Level 15

How are you sending it to Excel?

Tom

Jagadishkatam
Amethyst | Level 16

Were the dates in numeric format or character format.

if numeric, please check the format of the dates. If the format is fixed across the column then there should not be any problem in exported file.

If the format is not fixed, then the excel generated will have mixed formats. Could you please assign the fixed format to the column of date and check.

Thanks,

Jag

Thanks,
Jag
boey
Calcite | Level 5

Date Format.JPG

table on the left side is SAS list report output; table on the right side is exported excel output.

I have already fixed the format in SAS EG with DDMMYYS.10 but when sending to excel, the column shows the mixed format (date and character).

Jagadishkatam
Amethyst | Level 16

Could you please change the format to ddmmyy10. ,

i believe DDMMYYS.10 is not a valid format.

Thanks,

Jag

Thanks,
Jag
boey
Calcite | Level 5

sorry, it is DDMMYYS10., it was just my typing error here.

kuridisanjeev
Quartz | Level 8

Yes,

as Jag said ,format name should be DDMMYYS10. instead of DDMMYYS.10

Thanks,

Sanjeev.K

TomKari
Onyx | Level 15

Yes, I've been able to replicate your problem. I'm guessing it's because SAS is sending the formatted value in the "dd/mm/yyyy" format, e.g. 01/02/2014, for Feb 1 2014, to excel. I've bumped into this a few times...any time excel sees "99/99/9999", it assumes mm/dd/yyyy as long as the first number isn't greater than 12.

I'm not sure of your requirements, but I was able to get the transfer to work by putting a format of date9. on my date column in the List Report task. This sends it to excel in an unambiguous 01feb2014 format, which excel recognizes. From there, you can format it in excel.

Tom

boey
Calcite | Level 5

It helps! Thanks Tom!

Boey

NaveenSrinivasan
Calcite | Level 5

Hi,

I'd like suggest you to

1. apply your desired format whether dd/mm/yyyy or mm/dd/yyyy by modifying the code using the format statement that should be written to the output datset.  Safely, this should resolve.

2. Verify the results by checking with filter.

3. Then export to excel

I am guessing  there might be an issue in permanently associating(storing) your desired Date format in the descriptor portion of the output dataset, which you are trying to export to excel.

HTH,

Naveen

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 3040 views
  • 1 like
  • 5 in conversation