DATA Step, Macro, Functions and more

Maintaing date format when exporting to XLSX

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 76
Accepted Solution

Maintaing date format when exporting to XLSX

How do I maintain date formats in Excel when using PROC EXPORT?  I have tried ODS Excel but need to maintain the default Excel styling and not use any SAS styling. 


Accepted Solutions
Solution
‎12-20-2017 11:28 AM
Super User
Posts: 23,224

Re: Maintaing date format when exporting to XLSX

Posted in reply to tomcmacdonald

If I export a data set with SAS date9 format it seems to be fine using DMBS=XLSX

 

Or use ODS EXCEL and chose style=minimal to have little SAS formatting. You could also make your own style that had minimal to no changes.

 

proc export data=sashelp.stocks outfile='C:\_localdata\temp\test1.xlsx' dbms=xlsx replace; run;

ods excel file='C:\_localdata\temp\test2.xlsx' style=journal2;

proc print data=sashelp.stocks;
run;

ods excel close;

 

 

 

 

View solution in original post


All Replies
Solution
‎12-20-2017 11:28 AM
Super User
Posts: 23,224

Re: Maintaing date format when exporting to XLSX

Posted in reply to tomcmacdonald

If I export a data set with SAS date9 format it seems to be fine using DMBS=XLSX

 

Or use ODS EXCEL and chose style=minimal to have little SAS formatting. You could also make your own style that had minimal to no changes.

 

proc export data=sashelp.stocks outfile='C:\_localdata\temp\test1.xlsx' dbms=xlsx replace; run;

ods excel file='C:\_localdata\temp\test2.xlsx' style=journal2;

proc print data=sashelp.stocks;
run;

ods excel close;

 

 

 

 

☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 207 views
  • 0 likes
  • 2 in conversation