Usage Note 23934: Save a table from a procedure to a data set but suppress all displayed results
You can use ODS statements to control which tables and graphs a procedure displays, and also to save selected tables or data from graphs to data sets. This note illustrates how you can use the ODS OUTPUT statement to save a table to a data set. This note discusses how data from ODS graphs can be saved to a data set.
To suppress all displayed results of one or more procedures, specify the ODS EXCLUDE ALL; statement to begin suppression of displayed results, and then the ODS SELECT ALL; statement to resume the display of results. Following the ODS EXCLUDE ALL; statement you can include ODS SELECT statements to allow certain tables or graphs to be displayed.
The normal displayed results of PROC CORRESP include several tables and a graph. In the following example, the ODS statements suppress the display of all results, except for the graph ("ConfigPlot"), and save the "Observed" table to a data set. Since the ODS SELECT ALL; statement precedes the PRINT step, its results are displayed.
Names of tables and graphs for use in ODS statements can be found in the "ODS Table Names" and "ODS Graphics" sections of the procedure documentation.
data operate;
input Hospital Treatment $ Severity $ wt @@;
datalines;
1 a none 23 1 a slight 7 1 a moderate 2
1 b none 23 1 b slight 10 1 b moderate 5
1 c none 20 1 c slight 13 1 c moderate 5
1 d none 24 1 d slight 10 1 d moderate 6
2 a none 18 2 a slight 6 2 a moderate 1
2 b none 18 2 b slight 6 2 b moderate 2
2 c none 13 2 c slight 13 2 c moderate 2
2 d none 9 2 d slight 15 2 d moderate 2
3 a none 8 3 a slight 6 3 a moderate 3
3 b none 12 3 b slight 4 3 b moderate 4
3 c none 11 3 c slight 6 3 c moderate 2
3 d none 7 3 d slight 7 3 d moderate 4
4 a none 12 4 a slight 9 4 a moderate 1
4 b none 15 4 b slight 3 4 b moderate 2
4 c none 14 4 c slight 8 4 c moderate 3
4 d none 13 4 d slight 6 4 d moderate 4
;
ods exclude all;
proc corresp data=operate observed;
weight wt;
table treatment,severity;
ods select ConfigPlot;
ods output Observed=TableOut;
run;
ods select all;
proc print data=TableOut;
run;
Following are the displayed results from the above statements. Note that only the graph from PROC CORRESP is displayed. All other results from PROC CORRESP are suppressed. The TableOut data set was saved by the ODS OUTPUT statement and displayed by the PROC PRINT step.
a |
7 |
61 |
28 |
96 |
b |
13 |
68 |
23 |
104 |
c |
12 |
58 |
40 |
110 |
d |
16 |
53 |
38 |
107 |
Sum |
48 |
240 |
129 |
417 |
|
Note that some procedures have a NOPRINT option to suppress all displayed results. This can be used with individual procedures if the data set that you want to save can be created by a statement or option in the procedure. However, the NOPRINT option only applies to the results of a single procedure and it cannot be used with the ODS OUTPUT statement.
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Usage Note |
Priority: | low |
Topic: | Analytics ==> analytics
|
Date Modified: | 2004-04-30 09:45:44 |
Date Created: | 2004-04-21 15:08:03 |