Programming the statistical procedures from SAS

Keys -F12 and graph clearning.

Reply
SAS Employee
Posts: 185

Keys -F12 and graph clearning.

Hi All,

I was just wondering if there is a quick way to clear the graph window using the keys?

I have setup the F12 key to clear the log and output but the only way I know how to clear the graph(s) is by using proc greplay.

any advice would be much appreciated!

Merry Christmas
SAS Super FREQ
Posts: 8,781

Re: Keys -F12 and graph clearning.

Hi:
The log and output windows are just ASCII text -- fairly easy to clear. But, the GRAPH1 window is a "viewer" into WORK.GSEG, a SAS catalog, where the graph segment entries are stored during your session. So they are not as easily cleared as the ASCII log and output window. You can also use PROC CATALOG to delete WORK.GSEG, as described in this note:
http://support.sas.com/kb/13/045.html

(If you are using SAS 9.2 and the new ODS GRAPHICS facility, however, graph output is NOT stored in WORK.GSEG. Instead, the PNG (or other format) graph images are stored in the location specified by your ODS destination PATH= option (or your working directory for the LISTING destination.) To delete these files, I frequently use an X command to delete an earlier version of the file before I recreate the image file. These files are viewed with the default picture viewer on your system -- in my system, for example, the default viewer for ODS GRAPHICS template-based graphic output is the Windows Picture and Fax Viewer.)

cynthia
SAS Employee
Posts: 185

Re: Keys -F12 and graph clearning.

Thanks Cynthia,

I will be teaching 9.2 soon and I always get asked the question about clearning graphs, I just didn't know if some other way had been created in 9.2.

What is the X command?
SAS Super FREQ
Posts: 8,781

Re: Keys -F12 and graph clearning.

Hi:
The X command is a way to issue an operating system command.

http://support.sas.com/documentation/cdl/en/hostwin/61924/HTML/default/win-cmd-x.htm
http://support.sas.com/documentation/cdl/en/hosto390/61886/HTML/default/mvs-win-x.htm
http://support.sas.com/documentation/cdl/en/hostvms/62450/HTML/default/alp-cmd-x.htm

So, for example, in regard to image files, let's say that I want my job to create a file called MYGRF.JPG -- I can control the "MYGRF" part of the name with either the NAME= option for device-based SAS/GRAPH or with the IMAGENAME= option of the ODS GRAPHICS statement. The extension will come from either the DEV= option or the IMAGEFMT= option.

In my program, if I want to be sure that the older version of that file is not in the output directory, I can do this:
[pre]
options noxwait;
x "del c:\temp\mygrf.jpg";

OR

options noxwait;
x "mkdir c:\temp\MyReport_files";

OR

options noxwait noxsync;
x 'c:\temp\mycopylist.bat';
[/pre]

Or, I can make a directory to hold my output, as shown in the second example. Or, I can run a .BAT or .CMD file. It's a pretty cool way to do some operating system administrative clean-up or set-up. The X command is normally disabled for EG...so you may have to work with your SAS Admin to get it turned on if you're just using EG.

I mentioned the X command because with ODS Graphics, the graphic output is NOT displayed in the GRAPH1 window, so you would not need to clear WORK.GSEG, but instead would or might want to delete previously created graphic image files that reside on disk. Normally with device-based SAS/Graph, you would not usually use the X command.

cynthia
Ask a Question
Discussion stats
  • 3 replies
  • 153 views
  • 0 likes
  • 2 in conversation