Search code examples
sasstatisticsdistributionresultsetproc

How to clear "Results" from Proc Univariate to show only a specific table


I´ve been using the UNIVARIATE proccedure in order to get the p-value from a series of distributions (lognormal, exponential, gamma) and have reached the following problem:

I am using the following code to get the p-values of the goodness of fit tests for each of the distributions:

ods select all/*ParameterEstimates GoodnessOfFit*/;
proc univariate data=results.Parametros_Prueba_1;
      var Monto_1.;
      histogram /
      lognormal (l=1  color=red SHAPE=&ParamLOGN2_1  SCALE=&ParamLOGN1_1)
      gamma (l=1  color=red    SHAPE=&ParamGAM1_1 SCALE=&ParamGAM2_1)
      exponential   (l=2 SCALE=&ParamEXP1_1);
ods output GoodnessOfFit=results.Goodness_1;
run;

proc print data=results.Goodness_1;

After running the previous code I get the "Results" which gives me the histogram graphic and other descriptive information about the tests. I am looking for a way to get this "Results" print to show only the last part corresponding to the "proc print" added on the last line.

Thanks in advance!


Solution

  • If you want no output to the screen (results window) from PROC UNIVARIATE, then the simplest answer is:

    ods select none;
    proc univariate ... ;
    run;
    ods select all;
    proc print ... ;
    run;
    

    ods select none; tells ODS to not make any ODS output whatsoever. You'll still get your ODS OUTPUT though as that comes in afterwards.

    ods select none;
    proc univariate data=sashelp.class;
      var height;
          histogram name='univhist' /
          lognormal (l=1  color=red  )
          gamma (l=1  color=red    )
          exponential   (l=2  );
    ods output GoodnessOfFit=Goodness_1;
    run;
    ods select all;
    proc print data=Goodness_1;
    run;
    

    Now, you'll note you don't get your histogram; that one is harder. It unfortunately changes its name every time you run it, and even if you use the NAME= option, that'll only work the first time it's run. You need to use PROC GREPLAY to delete it.

    proc greplay nofs igout=work.gseg;
      delete 'univhist';
    run; quit;
    

    (Assuming UNIVHIST is the name you assign it.)