Programming the statistical procedures from SAS

Histograsm statement in proc univariate(sas 9.2)

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,040
Accepted Solution

Histograsm statement in proc univariate(sas 9.2)

Hi,

I want to generate a Histogam in the Univariate procedure and I get this warning

"WARNING: ODS Graphics is experimental in this release of the UNIVARIATE procedure."

Can anyone help me get the Histogram in the pdf format.

Thanks


Accepted Solutions
Solution
‎08-15-2012 03:48 PM
Super User
Posts: 10,857

Re: Histograsm statement in proc univariate(sas 9.2)

The warning is there because behavior of the options related to the procedure could change in future releases.

The generate PDF output use

ODS PDF file="path and file name you want.pdf" ; /* there are other options but this is minimal*/

/* your univariate or other output code goes here*/

ods pdf close;

View solution in original post


All Replies
Solution
‎08-15-2012 03:48 PM
Super User
Posts: 10,857

Re: Histograsm statement in proc univariate(sas 9.2)

The warning is there because behavior of the options related to the procedure could change in future releases.

The generate PDF output use

ODS PDF file="path and file name you want.pdf" ; /* there are other options but this is minimal*/

/* your univariate or other output code goes here*/

ods pdf close;

Super Contributor
Posts: 1,040

Re: Histograsm statement in proc univariate(sas 9.2)

Thank you so very much for the answer. This forum is very useful. I had to use all of the following too..

ods trace on;

ods exclude  Moments BasicMeasures TestsForLocation Quantiles ExtremeObs;

ods pdf file="C:\Data\abc.pdf";

Is there any direct way to get only the Histogram in our PDF. If I dint do the ods exclude I get 3 pages and my interest is onlt the histogram.

Could not use ods INCLUDE. It says the file name is not correct!!so i went the round way

Super User
Posts: 18,549

Re: Histograsm statement in proc univariate(sas 9.2)

use no print in your univariate procedure:

options nodate nonumber;

ods pdf file='C:\temp\example.pdf' notoc;

proc univariate data=sashelp.class NOPRINT;

     histogram height;

run;

ods pdf close;

Super Contributor
Posts: 1,040

Re: Histograsm statement in proc univariate(sas 9.2)

Also on the X-axis I get variable label(Average_cost_per_Gallon). What do I have to do to Rename that label to something else (Average Cost per Gallon)

Thanks in Advance

Super User
Posts: 18,549

Re: Histograsm statement in proc univariate(sas 9.2)

Add a label to your variable ie

label average_cost_per_gallon='Average Cost per Gallon';

SAS Super FREQ
Posts: 3,547

Re: Histograsm statement in proc univariate(sas 9.2)

The opposite of EXCLUDE is SELECT, not "include." Thus you can say

ODS SELECT Histogram;

Super Contributor
Posts: 1,040

Re: Histograsm statement in proc univariate(sas 9.2)

Thanks Rick

Super User
Posts: 18,549

Re: Histograsm statement in proc univariate(sas 9.2)

That doesn't work for me Rick:

598  ods select Histogram;

599  proc univariate data=sashelp.class;

600  var height;

601  histogram height;

602  run;

WARNING: Output 'Histogram' was not created.  Make sure that the output object name, label, or path is spelled

         correctly.  Also, verify that the appropriate procedure options are used to produce the requested output

         object.  For example, verify that the NOPRINT option is not used.

NOTE: PROCEDURE UNIVARIATE used (Total process time):

      real time           1.45 seconds

      cpu time            0.11 seconds

SAS Super FREQ
Posts: 3,547

Re: Histograsm statement in proc univariate(sas 9.2)

It works provided that ODS graphics are enabled.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 620 views
  • 3 likes
  • 4 in conversation