I am trying to update some older programming to use ODS. Outputting using ODS will create an unreadable excel file if the dataset is empty. We need to be able to output empty datasets to show that there is no result from an analysis. When using proc export, it will output to Excel fine, even if the dataset is empty. It will just have the variables in the dataset listed horizontally, as one would expect. ODS Code: %let date = %SYSFUNC(PUTN(%sysevalf(%SYSFUNC(TODAY())-1),DATE9.)); ods excel file="\\ctxibs\IBSProd\IBS\Inputs\GAATS\NATGapCounter_&date..xlsx";
ods excel options(start_at="1,1" sheet_name="NATCOUNTER" sheet_interval="table" embedded_titles='yes');
proc print data=EGTASK.NATCounter noobs; run; Proc Export Code: %let date = %SYSFUNC(PUTN(%sysevalf(%SYSFUNC(TODAY())-1),DATE9.));
/* Send to Excel */
proc export data=EGTASK.APPEND_TABLE_0038
dbms=xlsx
outfile="\\ctxibs\IBSProd\IBS\Inputs\GAATS\StrangeFlights_&date..xlsx"
replace;
run; Again ODS will create the Excel file if the dataset is empty, Excel will just say there are "unreadable" characters and bomb. Proc Export is fine. Is this just the case that ODS does not work in the case of empty datasets? If the dataset has no data, I need to still be able to write to Excel a file that has the variable names. Or should I just stick with proc export? Cheers
... View more