Search code examples
sasods

SAS 9.4 - Re-activate Results Viewer after ODS HTML CLOSE but suppress writing HTML Body File


When I need to export to Excel in SAS 9.4, I typically run a code like this:

ods html close;
ods html file="C:\folder\filename.xls";
ods html close;
ods html; /*with this I'm trying to send my output back to the results viewer once more*/

However, when I run the last ODS HTML to try to send to Results Viewer, the log displays the following message:

"Writing HTML Body file: sashtml1.htm."

This makes the results show up in the Results Viewer but also creates a file on my computer (sashtml1.htm) in the folder with my SAS code. I don't want the output to save to my computer, I only want to view it in SAS. How should I code differently to accomplish this? I do not want to open and re-open SAS.


Solution

  • Don't close the original one. Just tell SAS not to send it anything.

    ods html exclude all ;
    

    When you open the second one give it an ID.

    ods html (id=ForExport) file="C:\folder\filename.xls";
    

    Then you can close the new one and reanimate the old one.

    ods html (id=ForExport) close ;
    ods html exclude none ;