Clear the Results viewer in SAS 9.3

This post was kindly contributed by Ken's SAS tricks - go there to comment and to read the full post.

 

The Problem

The new default output destination in SAS 9.3 is the “Results Viewer” rather than the “Listing” window.  The results viewer shows an html file that integrates text and graphical output.  It’s pretty, and it’s very nice (sometimes) to see graphics with some other relevant output.

However, long-time SAS users may feel somewhat at a loss if they try to clear the results viewer window the way they used to clear the listing.  The “Clear/New” button on the toolbar is grayed out!

 

Potential Solutions

SAS has a usage note about this– there must be many people who, like me, end up with hundreds or thousands of pages in the results viewer.  They suggest using

ods html newfile=proc;

Unfortunately, the usage note is too draconian– it generates new results windows with every proc!  Now I have a proliferation of files, and can’t find old output easily.

 

Rick Wicklin suggests closing the output file and opening a new one with 

ods html close; ods html; 

That works OK, but it’s a lot of typing to replace what used to be a mouse click.

 

Just right

The gsubmit command allows you to submit SAS code from a function key or toolbar.

A. Function key

  1. Open the KEYS window by typing keys in the command bar (that white space to the left of the icons).
  2. In any empty space, type: gsubmit “ods html close; ods html;”

The key will now shut the current results file and open a new one.  Note that the old results don’t disappear until you generate some more output.  In addition, I believe the old output file (sashtml#.htm) still exists somewhere, if you kill something by mistake that you need back.  Its location is probably buring somewhere in the defaults.

B. Toolbar button

  1. With the results viewer window in focus, right-click in the toolbar.  Or click Tools > Customize.
  2. Click on the “Add tool” button (leftmost after the divider)
  3. For the command, type: gsubmit “ods html close; ods html;”
  4. Add help text and tip text (rollover) if you like
  5. Choose an icon for the new tool with the “Change icon” button (third one).  There’s a pencil erasing about 35% of the way through the options– my choice. 
  6. Use the up and down arrows to move the new tool to where you want it to be.
  7. Click OK and then Yes to save permanently.

As with the function key method, your new button will shut the current results file and open a new one.  And the other observations are true here as well.

 

 

This post was kindly contributed by Ken's SAS tricks - go there to comment and to read the full post.