suppress default listing of PROC UNIVARIATE in the Result Viewer

Reply
Contributor
Posts: 61

suppress default listing of PROC UNIVARIATE in the Result Viewer

hello,

My name is Chang. I have a self-written macro for performing test of normality using PROC UNIVARIATE. This macro works well. I would like to suppress the default listing of stat and charts in the results viewer, as this has slowed down my SAS. I've learned to specify the NOPRINT option in the proc univariate; however, I got strange error message. The macro worked again as usual when the NOPRINT was removed. I speculate that this may be due to my ODS OUTPUT statement (see step03 in the codes), which I would like to output only the result of normality tests to another data set. I am pasting my working codes. I didn't encounter any problems when running the codes with a mock data set containing normally-distributed values generated from the normal(seed) function, whether the NOPRINT was included or removed. My data are attached in the excel spreadsheet "EDvolume_a_wide." The SAS log is also attached. Any comments are appreciated. Thanks

/*step01: create a blank tables to hold the output from each loop*/

data normality;

    reminder='delete this observation'; /*the first line of table will be missing. I just add this note to remind you to delete this first row*/

run;

%macro normality    (    data=,

                                      by_groups=,

                                      classVar=,

                                      var=);

/*step02: sort data*/

proc sort data=&data.; by &by_groups.; run;

/*step03: perform tests of normality for a continuous variable*/

proc univariate data= &data. normal ; /*error occurs if noprint is specified between PROC and normal option*/

    by &by_groups. ;

    class &classVar.;                  /*Specify only one CLASS variable*/

    var &var.;

    ods output TestsForNormality=    _normality_&var.; /*output result of normality test*/

run;

/*step04: sort normality test result by test name*/

proc sort data= _normality_&var. out= normality_&var.; by Test &by_groups.; run;

data normality_&var._a(drop= VarName pType pSign);

    set normality_&var.;

    variable= "&var.";

    if pValue < 0.05 then normal='N'; else normal='Y';

    format Stat 5.3 pValue pValue5.3;

run;

*step05: collect normality test results from each macro invocation*;

data normality; set normality normality_&var._a; run;

%mend normality;

/*step06 calling the macro*/

%normality(data=EDvolume_a_wide, by_groups=holiday, classVar=holiday, var=day_EDvolume);

Attachment
Respected Advisor
Posts: 2,655

Re: suppress default listing of PROC UNIVARIATE in the Result Viewer

NOPRINT suppresses the table that ODS output is trying to create.  Rather than NOPRINT for PROC UNIVARIATE, check into using other ODS options to accomplish this.  Off the top of my head, look at ODS LISTING CLOSE, but I'm not sure.

Steve Denham

Contributor
Posts: 61

Re: suppress default listing of PROC UNIVARIATE in the Result Viewer

Posted in reply to SteveDenham

thanks

Ask a Question
Discussion stats
  • 2 replies
  • 513 views
  • 0 likes
  • 2 in conversation