2
votes

I have the problem that while I want to conditionally select output table from Results Window.

In the following data set, there are three tables after running the program: 1. Variable Information 2. Simple statistics 3. Pearson correlation

The first thing for What I want is just selecting out the second and third table. I know the code like

ods listing close;
ods select
'Variable Information';

But I don't know how to select two table at once.

The second question is that I want to use PROC REPORT to print out the out1 data set and export it into Excel. How can I suppress the matrix printed out in the results viewer? I tried using NOPRINT, but it doesn't work.

The third question is that if I want to only select out variable X from Simple Statistics like this:

  Simple Statistics

  Variable           N          Mean       Std Dev           Sum       Minimum       Maximum

  x                  4       3.75000       2.50000      15.00000       1.00000       7.00000

How could I do?

The code is below:

data test;
  input x y z;
cards;
1 4 7
4 2 9
3 5 2
7 1 3
;
run;

proc corr data=test outp=out1;
  var x y z;
run;
1

1 Answers

2
votes

To select multiple outputs, simply list them in the ODS SELECT.

ods select SimpleStats PearsonCorr;

To ask PROC REPORT not to generate results, turn off ODS LISTING (or whatever destination you have), and also use NOWD of course. I would use

ods _all_ close;

Put that before your output selection.

To filter your out1 dataset, use a where statement on the out=out1 option.

proc corr data=test outp=outp1(where=(_NAME_=x));