Select the Output Objects

Using ODS Statements

Once you have identified all of your output objects, you can use the ODS SELECT statement or the ODS EXCLUDE statement to select or exclude output objects. You can use the name, label, or path to specify the output object in either of these ODS statements.
proc sort data=sashelp.prdsale out=prdsale;
    by Country;
run;
ods html file='your-file-path\HTMLPrdhtml.html';
ods document name=work.prddocument(write);
proc tabulate data=prdsale;   
class region division prodtype;   
classlev region division prodtype;   
var actual;   
keyword all sum;
keylabel all='Total';   
table (region all)*(division all),
         (prodtype all)*(actual*f=dollar10.) /
         misstext=[label='Missing']
         box=[label='Region by Division and Type']; 
 
title 'Actual Product Sales';
title2 '(millions of dollars)';
run;
ods select ExtremeObs Quantiles Moments;

proc univariate data=prdsale;
    by Country;
    var actual;
run;
proc sgpanel data=prdsale;
    where quarter=1;
    panelby product / novarname;
    vbar region / response=predict;
    vline region / response=actual lineattrs=GraphFit;
    colaxis fitpolicy=thin;
    rowaxis label='Sales';
run;
ods html close;
ods document close;
You can use the ODS EXCLUDE statement instead of the ODS SELECT statement. The following ODS EXCLUDE statement gives you the same results:
ods exclude BasicMeasures TestsForLocation;

Using the Documents Window

If you want to use the Documents window to select your output objects and to store your updated output, you must create a new ODS document.
In a previous chapter, you created an original ODS document. You can recall that ODS document.
proc sort data=sashelp.prdsale out=prdsale;
    by Country;
run;

ods document name=work.prddocument(write);

proc tabulate data=prdsale;   
class region division prodtype;   
classlev region division prodtype;   
var actual;   
keyword all sum;
keylabel all='Total';   
table (region all)*(division all),
         (prodtype all)*(actual*f=dollar10.) /
         misstext=[label='Missing']
         box=[label='Region by Division and Type']; 
 
title 'Actual Product Sales';
title2 '(millions of dollars)';
run;

proc univariate data=prdsale;
by Country;
var actual;
run;
title 'Sales Figures for First Quarter by Product';
proc sgpanel data=prdsale;
    where quarter=1;
    panelby product / novarname;
    vbar region / response=predict;
    vline region / response=actual lineattrs=GraphFit;
    colaxis fitpolicy=thin;
    rowaxis label='Sales';
run;
ods document close;
To create a new ODS document, right-click the Documents folder at the top of the Documents window, and then select New Document.
Creating a New ODS Document
Creating a New ODS Document
In the New Document window, select a library in which to store the new document, and enter a name for the document. Click OK.
Naming a New ODS Document
Naming a New ODS Document
Because you selected the library Sasuser, your document is stored permanently.
New Empty Document PrdCustomContent
New Empty Document PrdcustocContent
When you create a new document, it is empty. You can load output into the new document by using the Documents window in two ways. You can copy and paste output from the original document (Work.PrdDocument) into the new document (Sasuser.Prdcustomcontent). Or, you can drag and drop output into the new document. You can load individual output objects one by one, as is shown below, or you can add all of the output at once. Then, you can rearrange the output. In the output below under Sasuser.Prdcustomcontent, PROC SGPANEL output is before PROC TABULATE and PROC UNIVARIATE output. Note that you can use PROC DOCUMENT statements to accomplish all these tasks without using the Documents window. For complete documentation on the DOCUMENT procedure, see the The DOCUMENT Procedure in SAS Output Delivery System: Procedures Guide.
Adding Output to the Sasuser.Prdcustomcontent Document
Adding Output to the Sasuser.Prdcustomcontent Document
Next, drag, and drop the UNIVARIATE procedure output from Work.Prddocument into Sasuser.Prdcustomcontent. All of the output objects that PROC UNIVARIATE creates are copied into the new document.
Adding the UNIVARIATE Procedure Output
Adding the UNIVARIATE Procedure Output
All output objects are in the new document. Delete the PROC UNIVARIATE output objects Basic Measures of Location and Variability and Tests For Location. Right-click on an object, and select Delete.
Delete Output Objects
Delete Output Objects
Sasuser.Prdcustomcontent now contains all of the output from PROC SGPANEL and PROC TABULATE. The UNIVARIATE output now consists of only the Moments, Quantiles, and Extreme Observations tables for Canada, Germany, and the United States.
Completed New Document
Completed New Document
Now that you have the output that you want in the new document, you can re-create the output with only the data that you want shown. Right-click Sasuser.Prdcustomcontent, and select Replay. This displays your output to any open destinations without rerunning the procedures.
Replay the New Document
Replay the New Document

Comparing the Two Methods

If you have your output in an ODS document, you might find it easier to select and exclude output using the Documents window or PROC DOCUMENT. By using PROC DOCUMENT, you do not need to access the data or run the program again. It is easy to rearrange and rename your output objects in the Documents window.
If you do not have your output in an ODS document and you have many output objects to select or exclude, you might want to use the ODS SELECT or ODS EXCLUDE statement. In both of these ODS statements, you can create one line of code that selects or excludes all output objects that you want it to. You can place these ODS statements anywhere in the program.