Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does PROC UNIVARIATE NOPRINT PLOTS display no output?

Tags:

sas

I have a simple data set that I would like to analyze using stem-and-leaf/boxplots, but I only want the textual graphs, not the output tables. This is the data step:

DATA CLINIC;
   INPUT ID     $ 1-3
         GENDER $   4
         RACE   $   5
         HR       6-8
         SBP      9-11
         DBP     12-14
         N_PROC  15-16;
   AVE_BP = DBP + (SBP - DBP)/3;
DATALINES;
001MW08013008010
002FW08811007205
003MB05018810002
004FB   10806801
005MW06812208204
006FB101   07404
007FW07810406603
008MW04811207006
009FB07719011009
010FB06616410610
;

I'm using proc univariate, but I'd like to suppress the output of only the tables, not the plots themselves. Using the noprint statement, all output is suppressed:

proc univariate noprint;
var SBP DBP;

Using only the plots option, no output is suppressed, so both the plots and the tables are shown.

proc univariate plots;
    var SBP DBP;

Obviously, specifying both doesn't work either.

proc univariate plots noprint;
    var SBP DBP;

Is there any way to suppress only the tables, not the plots themselves?

UPDATE: I worked the suggested code into my full code sample, and both the tables and the plots are still displayed. Here is the full code sample, run in a fresh SAS session on a different machine than the previous code (both machines use SAS 9.3).

PROC DATASETS LIBRARY=WORK;
DELETE clinic;

DATA clinic;
INPUT @1 ID $ 3. @4 GENDER $ 1. @5 RACE $ 1.
      @6 HR 3. @9 SBP 3. @12 DBP 3. @15 N_PROC 2.;

AVE_BP = DBP + (SBP - DBP) / 3;

DATALINES;
001MW08013008010
002FW08811007205
003MB05018810002
004FB   10806801
005MW06812208204
006FB101   07404
007FW07810406603
008MW04811207006
009FB07719011009
010FB06616410610
;

PROC MEANS DATA=clinic N MEAN STD CLM MEDIAN;
TITLE "Means";
VAR SBP DBP AVE_BP;

ODS TRACE ON;
ODS SELECT Plots;
PROC UNIVARIATE DATA=clinic PLOTS;
TITLE "Plots";
VAR SBP DBP;
RUN;
ODS TRACE OFF;
ODS SELECT ALL;
like image 544
Ricardo Altamirano Avatar asked Dec 19 '25 03:12

Ricardo Altamirano


1 Answers

Since version 8, when Output Delivery System (ODS) was added to SAS, I'm a big fan of it.

  1. Use ods trace on; + original code (proc univariate... here) to determine (from LOG) what outputs is it producing (also visible in Results Tree).
  2. Then use ods select ...; to make you selection.
  3. Use ods select all; to reset back.
ods trace on;
ods select Plots;
proc univariate plots;
var SBP DBP;
run;
ods trace off;

ODS is much more then this, certainly worth studying - make a search for ODS user guide.

like image 69
vasja Avatar answered Dec 21 '25 05:12

vasja



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!