@Ali_jarmak wrote:
Dears By using ODS Excel, the below code is giving 2 different results for year5. date format. Proc print is giving the right results , while for proc tabulate is not the case. To simplify the example, I have used a data set with 1 observation only. Any Idea how it can be resolved without creating new variable for year. ALi
data x;
datex='12jun18'd;
run;
ods EXCEL file="d:\temp\ODSExcel.XLSX" options(sheet_interval="NONE"
EMBEDDED_TITLES='ON');
proc print data=x noobs;
format datex year5.;
title "Proc Print";
run;
proc tabulate data=x;
table datex, n;
class datex;
format datex year5.;
Title "Proc Tabulate";
run;
ods excel close;
I am not surprised by anything Excel does that reformats values.
If you click in the cell with the "year" you will likely see "6/12/2018" in the Proc Print output and note that the Excel "Format Cells" will show on the Number tab that the value is displayed with a "custom" date value of YYYY and an integer value of 43263,
In the Proc Tabulate you will see "7/11/1965" and an underlying numeric value of 23934. Which is neither the SAS date numeric value of 21347.
The tagsets.excelxp value is appears as expected for the same code.
So we may have an ODS Excel issue or Excel itself doing something in the background...
... View more