I have no trouble making an XLS file on SAS On Demand and then downloading the file to my personal computer and opening it with the Numbers application on MacOS.
73 %put &=sysvlong;
SYSVLONG=9.04.01M8P022223
74 filename xls '~/example.xls';
75 proc export data=sashelp.class dbms=xls file=xls replace;
76 run;
NOTE: The export data set has 19 observations and 5 variables.
NOTE: "XLS" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
real time 0.30 seconds
cpu time 0.06 seconds
And it does not matter if the file already exists. The existing file is overwritten with a new good XLS file.
73 %put &=sysvlong;
SYSVLONG=9.04.01M8P022223
74 filename xls '~/example.xls';
75 data _null_;
76 file xls;
77 put 'garbage';
78 run;
NOTE: The file XLS is:
Filename=/home/tom.abernathy/example.xls,
Owner Name=tom.abernathy,Group Name=oda,
Access Permission=-rw-r--r--,
Last Modified=10Jun2026:11:29:46
NOTE: 1 record was written to the file XLS.
The minimum record length was 7.
The maximum record length was 7.
NOTE: DATA statement used (Total process time):
real time 0.88 seconds
cpu time 0.05 seconds
79 proc export data=sashelp.class dbms=xls file=xls replace;
80 run;
NOTE: The export data set has 19 observations and 5 variables.
NOTE: "XLS" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
real time 0.68 seconds
cpu time 0.08 seconds
Perhaps you are trying to write to a file that is already open in another application?
Perhaps you downloaded the wrong file?
Perhaps you have something wrong in your SAS installation? Open a ticket with SAS support.
Hi,
We are unable to open an .xls file generated by a SAS program on a local desktop. However, the same program works correctly when generating an .xlsx file.
Error message: “We found a problem with some content in <filename.xls>.”
This issue started occurring after upgrading to SAS 9.4 M8. The same functionality was working fine in SAS 9.4 M7.
Note: There are no special characters in the file.
Statement:
proc export data=sample outfile=/home/raju/filename.xls" dbms=xls
replace;
run;
Regards,
Srinivas
We experienced a similar situation after a software upgrade where legacy .xls exports became unreliable while .xlsx files continued to work without any issues. Since the same code worked in the previous release, I'd also look at environment-specific differences such as the Excel drivers, operating system, or the way the files are transferred from the SAS server to the local machine. It would be interesting to know whether the issue can be reproduced on another M8 installation with the same code and dataset.
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.