A SAS programmer asked for help on a discussion forum: "My SAS session will not display any tables or graphs! I try to use PROC PRINT and other procedures, but no output is displayed! What can I do?"
The most common reasons why you might not see any output when you generate tables and graphs are:
- The select list is set to NONE or is otherwise preventing output from appearing.
- All ODS destinations are closed. This could happen if a program uses ODS <destination> CLOSE to close one or more ODS destinations.
A solution that usually works is to exit the current SAS session and start a new one. This will reset all ODS destinations. However, if the problem occurs every time you run a program, then something in the program is messing with the ODS destinations or SELECT list. In that case, it is helpful to understand how to examine the SELECT list and how to check which ODS destinations are open. This article shows you how to do those two things.
The quick solution
Let's jump straight to the solution. To make sure that you will see output, submit the ODS SELECT ALL statement, then make sure you have an open ODS destination. The following statements set the ODS SELECT list and display the active ODS destinations:
ods select all; /* clear the SELECT lists for all destinations*/ proc print data=sashelp.vdest; run; /* display open ODS destinations */ |
The output that you see will depend on which interface you are using to run SAS. In the old SAS Windowing Environment, you might see output like the following:
This output shows that the open destination is the HTML destination. In the newer SAS Studio interface, you might see output like the following:
This output indicates that there are two open destinations. The HTML5(WEB) destination is a newer version of the HTML destination. The LISTING destination is an old pre-HTML destination.
If you do not see any output from the PROC PRINT call, then check the log. If there are no open ODS destinations, then the log will display notes such as the following:
NOTE: No observations in data set SASHELP.VDEST. NOTE: There were 0 observations read from the data set SASHELP.VDEST. |
In this case, you need to study the code to find out why your program has closed all the destinations! In the SAS Windowing Environment, you can reopen ODS destinations fairly easily. In SAS Studio, it is best to open new destinations by using the menus and dialog boxes: Options->Preferences->Results.
The next sections look closer at these two statements and discuss a few related statements, including the ODS SHOW statement.
Examine the overall ODS SELECT list
The ODS system maintains a SELECT list for each ODS destination. It also maintains an overall (or "global") SELECT list, which applies to all destinations. To see the "global" SELECT list, you can submit the ODS SHOW statement:
ods show; /* display the overall SELECT list in the log */ |
The result of this statement is displayed in the SAS log. To ensure that all output is being routed to the open destinations, you want to see a log message such as the following:
Current OVERALL select list is: ALL |
If you see any other message in the log, it means that the SELECT list has changed, which affects which output appears when you try to display a graph or table. When you submit the ODS SELECT ALL statement, it clears all SELECT lists and ensures that all output makes its way to the open ODS destinations.
You can also set and clear destination-specific SELECT lists. For example, the following statements create a restricted SELECT list for only the LISTING destination. You can use ODS <destination> SHOW to view a destination-specific SELECT list, as follows:
ods LISTING; /* open the LISTING destination */ ods LISTING select ANOVA ParameterEstimates; /* select tables ONLY for LISTING */ ods show; /* display the overall SELECT list in the log */ ods LISTING show; /* display the SELECT list for the LISTING destination */ |
The SAS log shows the following text:
Current OVERALL select list is: ALL Current LISTING select list is: 1. ANOVA 2. ParameterEstimates |
The log reveals that the SELECT list for the LISTING destination is filtering the output. When you run the next procedure, only tables named ANOVA and ParameterEstimates will appear. All other tables and graphs are suppressed.
You can use ODS <destination> SELECT ALL to clear a specific destination. However, I recommend that you use ODS SELECT ALL without specifying a destination, which clears all destinations. This is shown in the following example:
ods select all; /* clear the SELECT lists for all destinations*/ ods LISTING show; /* display the SELECT list for the LISTING destination */ |
Current LISTING select list is set to default value (ALL). Current OVERALL select list is: ALL |
Examine open ODS destinations
Did you know that you can print the Sashelp.VDest data view to display the open ODS destinations and what style each is using? After you ensure that the ODS SELECT list is clear, run the following PROC PRINT statements:
proc print data=sashelp.vdest; run; |
You will see a table such as the one above. Each row displays the name and style for an open ODS destination. As mentioned earlier, if you have closed all destinations, you will get a note in the log that says:
NOTE: No observations in data set SASHELP.VDEST. NOTE: There were 0 observations read from the data set SASHELP.VDEST. |
If you are not familiar with the SasHelp.VDest view, it is a view of a a read-only PROC SQL table, which contains information about the current state of SAS. DICTIONARY tables are documented in the PROC SQL documentation. By looking at the documentation, you can discover that the DICTIONARY.Destinations table in PROC SQL contains information about open ODS destinations. If you want to read that information by using a non-SQL SAS procedure, use the SASHELP.VDest view, which contains the same information.
Summary
This article shows how to inspect and reset the ODS SELECT list to ensure that all output will be displayed by SAS. The article also shows how to use a dictionary table (DICTIONARY.Destinations) or its associated data view (Sashelp.VDest) to display the open ODS destinations.