Using the SAS Windowing Environment |
Overview of Working with Output |
You can manage your SAS procedure output with the SAS Output Delivery System (ODS). Procedures that fully support ODS can do the following:
combine the raw data that they produce with one or more table definitions to produce one or more output objects that contain formatted results
store a link to each output object in the Results folder in the Results window
can generate various types of file output, such as HTML, Listing, and in some cases, SAS/Graph output
provide a way for you to customize the procedure output by creating table definitions that you can use whenever you run the procedure
The SAS windowing environment enables you to use many features of ODS through the Results, Templates, Preferences, and SAS Registry Editor windows. The Results window provides pointers to the procedure output that is produced by SAS. The Templates window provides a way to manage all the table, column header, and style definitions (sometimes called templates) that can be associated with procedure output.
Finally, the Preferences window and the SAS Registry Editor can be used to set the type(s) of procedure output that you want SAS to produce.
This section details only those portions of ODS that are related to the SAS windowing environment. For more information about ODS, see Directing SAS Output and the SAS Log and SAS Output Delivery System: User's Guide.
Setting Output Format |
Depending on your operating environment, SAS output can be produced in one or more formats (or types). Listing output is the default type. Other output types include HTML, Output Data Sets, and PostScript. Pointers to procedure output appear in the Results window.
To set your output type, use either the Preferences window (if available in your operating environment), the SAS Registry Editor, or both.
If your operating environment supports the Preferences window, you can set output type as follows:
Select Tools Options Preferences or issue the DLGPREF command to open the Preferences window.
Select or deselect the check boxes that match the output types that you want to produce.
If you choose to produce HTML output, then you can further define the output by selecting:
Click the Style box and highlight a style. Styles among other things, define output colors and fonts.
the folder to which the output is saved
Select Use WORK folder to save HTML output only for the duration of the current session. Your output is deleted when your current SAS session ends.
Enter a path in the Folder text box to save HTML output to a folder that is not deleted when your SAS session ends.
the View Results as they are Generated check box
If selected, then each time HTML output is produced, your browser automatically opens and loads the output.
To set output type with the SAS Registry Editor:
Select Solutions Accessories Registry Editor or issue the REGEDIT command to open the SAS Registry Editor.
On the right side, select the Value key, and then select Modify from the pop-up menu.
In the dialog box that appears, edit the Value Data field as needed.
If this field is set to 1, then the output type is produced. If this field is set to 0, then the output type is not produced.
Assigning a Default Viewer to a SAS Output Type |
When you produce output in SAS, output pointers appear in the Results window. You can assign a default viewer for each of the types of output that you produce. After a default viewer is assigned, you can double-click an output pointer in the Results window to open output in its default viewer. For example, double-clicking on a PostScript output pointer could open Ghostview with your PostScript output loaded.
Operating Environment Information: In the Windows operating environment, default viewers are established automatically with information from your Windows Registry.
To assign a default viewer to a SAS Output Type:
Select Host Files from the drop-down menu at the top of the Explorer Options window.
Scroll through the registered file types until you find the file type with which you want to work.
Select Add, and then enter an action name and action command for the file type in the Edit Action window.
For example, add the following action name and action command to set Ghostview as the default viewer for PostScript file types:
Action Name | |
Action Command |
Select the action that you just specified, and then select Set Default.
Operating Environment Information: In the Windows operating environment, default viewers are established automatically with information from your Windows Registry.
Working with Output in the Results Window |
The Results window provides pointers to the procedure or DATA step output that SAS produces. This window might open by default when you start a SAS session. You can also open the Results window by selecting View Results or by issuing the ODSRESULTS command.
The Results Window in Tree View
You can use the Results window to do the following:
You can have the Results window display in one of three views:
In Tree view (the default), only a navigational tree is present. In Contents Only view, the tree is turned off, and contents appear as folders. In Explorer view, the Results window appears with two panes: one for the tree and one for the contents.
To toggle the Tree view pane, issue the TREE command from the Results window. To toggle the Contents pane, issue the CHILD command from the Results window. You can also select commands from the View menu of the Results window to perform the same actions, such as Show Tree, Show Contents, and others.
Note: By default, output pointers are listed by label rather than by name in the Tree pane. Labels are typically more descriptive than output names. You can use the following SAS system option to change this setting: LABEL.
When SAS runs a procedure or a DATA step, pointers to the output are placed in the Results window. To use the pointers in the Results window, see Navigating the Results Window in Tree View, Navigating the Results Window in Contents Only View, or Navigating the Results Window in Explorer View.
In Tree view, output pointers appear in a procedural hierarchy. To work with your SAS output:
Locate the folder that matches the procedure output that you want to view.
Use the expansion icons (+ or - icons) next to the folder to open or hide its contents.
When you locate the appropriate pointer, double-click the pointer or select the pointer and then select Open from the pop-up menu.
Operating Environment Information: If you are using the z/OS or CMS operating environment, then you can open a pop-up menu by typing ? in the selection field next to an item. Alternatively, you can type an s or x in the selection field next to an item.
You can also use the following ways to navigate in the Tree view:
Menu | View Up One Level |
Command | |
Toolbar | |
Key |
Depending on your operating environment, you might also use arrow and backspace keys to navigate. |
In Contents Only view, output pointers appear in a procedural hierarchy, beginning with the top level of the hierarchy. You can drill down or roll up within the hierarchy to find the appropriate output.
When you open a folder, the current window contents are replaced with the contents of the selected folder. To work with your SAS output:
Locate the folder that matches the procedure output that you want to view.
Select the folder, and then select Open from the pop-up menu.
When you locate the appropriate pointer, double-click the pointer or select the pointer, and then select Open from the pop-up menu.
Operating Environment Information: If you are using the z/OS or CMS operating environment, then you can open a pop-up menu by typing ? in the selection field next to an item. Alternatively, you can type an s or x in the selection field next to an item.
In Explorer view, two window panes exist. The left pane includes a hierarchical view (the Tree view) of the procedure output that you can view. The right pane shows the contents (the Contents view) of the item that is currently in focus.
You can delete results pointers by deleting the procedure folder in which the pointers exist. When you delete a procedure folder in the Results window, any output pointer that exists in that folder is removed.
Note: When you delete a procedure folder that contains a listing output pointer, the actual listing output is removed from the Output window. If other output pointers exist in the folder (such as HTML), then only the pointer is removed; the actual output remains available.
In the Results window, select the procedure folder that matches the procedure that you want to delete.
You can also delete output pointers by selecting the procedure folder that you want to delete, and then selecting Edit Delete.
You can also rename results pointers by selecting the pointer that you want to rename, and then selecting Edit Rename.
To save listing output to a file from the Results window:
Expand the Results window tree until you find the appropriate listing output pointer.
Select the listing output pointer, and then select Save As from the pop-up menu.
To save listing output to a file from the Output window:
On the command line, specify the FILE command followed by a fileref or an actual filename. If you use a filename, then surround the filename with quotation marks.
Note: The FILE command stores a copy of the information in the Output window without removing what is currently displayed.
To save listing output as a catalog object:
Expand the Results window tree until you find the appropriate listing output item.
Select the listing output item, and then select Save As Object from the pop-up menu.
To view the first output pointer item:
Select View from the pop-up menu.
The first output pointer item listed for the results pointer that you selected appears. For example, if you produced listing and HTML output for a procedure and the listing output was created first, then the listing output would appear.
You can view the properties of a Results window folder, an output pointer, or an output pointer item (such as listing or HTML output).
Working with Output Templates |
Templates contain descriptive information that enables the Output Delivery System (ODS) to determine the desired layout of a procedure's results.
The Templates window provides a way to manage all the templates that are currently available to SAS. Specifically, you can use the Templates window to do the following:
The Templates Window in Explorer View
You can open the Templates window by selecting View Templates from the Results window, or by issuing the ODSTEMPLATES command.
You can create or modify templates with PROC TEMPLATE.
Note: Templates that are supplied by SAS are stored in SASHELP. Templates that are created with PROC TEMPLATE are stored in SASUSER or whatever library that you specify in the ODS PATH statement.
The Templates window appears in one of three views:
In Explorer view (the default), the Templates window appears with two panes: one for the tree and one for the contents. In Tree view, only a navigational tree is present. In Contents Only view, the tree is turned off.
To toggle the Contents pane, issue the CHILD command from the Templates window. To toggle the Tree pane, issue the TREE command from the Templates window.
For more information, see Navigating the Templates Window in Explorer View, Navigating the Templates Window in Tree View, or Navigating the Templates Window in Contents Only View.
In Explorer view, two window panes exist. The left pane includes a hierarchical view (the Tree view) of the templates that you can view. The right pane shows the contents (the Contents view) of the template currently in focus.
You can open additional template windows from the Explorer view by selecting a template, and then selecting Explore from Here from the pop-up menu.
In Tree view, templates appear in a hierarchy. To work with a template:
Locate the folder that includes the template that you want to view.
Use the expansion icons (+ or - icons) next to the folder to open or hide its contents.
Double-click the template that you want to see, or select the template, and then select Open from the pop-up menu.
Operating Environment Information: If you are using the z/OS or CMS operating environments, then you can open a pop-up menu by typing ? in the selection field next to an item. Alternatively, you can double-click by typing an s or x in the selection field next to an item.
In Contents Only view, templates appear as folders. When you open a folder, the current window contents are replaced with the contents of the selected folder. To work with your templates in this view:
Locate the folder that includes the template that you want to view.
Select the folder, and then select Open from the pop-up menu.
You can also double-click on a folder to open it.
Double-click on the template that you want to see, or select the template, and then select Open from the pop-up menu.
The template code appears in a browser window.
Operating Environment Information: If you are using the z/OS or CMS operating environments, then you can open a pop-up menu by typing ? in the selection field next to an item. Alternatively, you can double-click by typing an s or x in the selection field next to an item.
To browse the PROC TEMPLATE source code:
To edit the PROC TEMPLATE source code:
Select the template, and then select Edit from the pop-up menu. Template code appears in an editor window.
Note: If syntax errors occur when the code for an edited template is submitted, then the errors appear in the Log window.
Note: Additional information for PROC TEMPLATE is available in the Base SAS Procedures Guide.
The Properties dialog box lists the type, path, size, description, and modification date for the template. You can also view this information by selecting View Details when the Templates window is active.
Printing Output |
The method that you use to print output depends on the type of output that you produce, as well as your operating environment. SAS windowing environment windows have menus with print options that enable you to print the contents of that particular window. This feature varies from operating system to operating system, but is available in all operating environments.
If you produce HTML output, then you can open the output in a Web browser, and then print the output from the Web browser with the Web browser's printing command.
For more information about printing, refer to your SAS operating environment companion documentation and your operating environment documentation.
Copyright © 2012 by SAS Institute Inc., Cary, NC, USA. All rights reserved.