I am using EG5.1. Is there a way we can delete excel file that is already saved on a server?
I am using the code below. I want to delete XLS if it exists already in this path - /fts/sas/bhandari/.
ODS HTML FILE = "/fts/sas/bhandari/results.xls";
PROC PRINT DATA = A;
RUN;
PROC PRINT DATA = A;
RUN;
ODS HTML CLOSE;
Is there a better way to output the result in a single data set or excel file? I have 2-3 tables. I want to stack the results. Each output is structured differently. I cannot use SET statement to combine them.
Thanks in anticipation!
SAS now has an FDELETE() function that can delete a file.
Why not just PROC EXPORT to create an XLS file?
Or ODS TAGSETS.EXCELXP it you really want to make a single sheet that two independent tables.
You are creating HTML content and write it to a file with a .xls extension. VERY bad style.
Use .html as the extension!
If you want to create something that will show well in Excel, including formatting and using multiple sheets, or multiple reports within one sheet, look at ODS TAGSETS.EXCELXP. Use .xml as the extension for the output file, as TAGSETS.EXCELXP creates XML code, and Excel may complain when opening a file where the content does not correspond to the filename extension.
Well, do you have permissions to read/write to that area? Is there a reason why you need to delete the file? As mentioned by JurtBremser, tagsets.excelxp will produce nicer looking XML files which Excel can read, however, what is the reason behind using Excel? Other than a specific request for something in Excel, and then more fool the person asking, I would never choose that as an output format for any purpose, its not a good transfer format, and review wise its to open to abuse.
Hi
Find below a code example where the FDELETE function is used in a macro
Bruno
Hi,
Thank you. This is helpful, in my environment I was not allowed to use xcommands and found this as my solution for a way how to delete files without using Xcommands.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.