Data visualization with SAS programming

Histograms

Reply
Contributor
Posts: 30

Histograms

Hi,
1) I'm looking for a procedure where I can make Histograms that aren't evenly spaced (say 0-100,100-500,500-10,0,1000-3500)

2) In proc univariate histogram statment - can I add graphic options- such as the graph's color etc.? Can I save it to a GIF file?

Thanks!
Super Contributor
Super Contributor
Posts: 3,174

Re: Histograms

Suggest starting here with a Google advanced search argument on the SAS.COM site.

histograms site:sas.com


Consider using SAS ODS for generating an image file such as a GIF.

The SAS support http://support.sas.com/ website has much to offer with SAS-hosted documentation, code samples, and supplemental topic-related reference papers.

Scott Barry
SBBWorks, Inc.
SAS Employee
Posts: 977

Re: Histograms

The easiest way I can think of to control the spacing (aka "bucketing" or "binning") in a histogram, is to create a user-defined format. The following example creates some fake/random data to demonstrate gchart's automatic binning (with levels=4), and then using a user-defined format (which I call 'myfmt') to make the bins exactly the way you want them ...

data foo;
do i = 1 to 1000;
value = 500 + 300*rannor(1);
output;
end;
run;

title "Using default gchart ranges";
proc gchart data=foo;
vbar value / type=freq levels=4;
run;


proc format;
value myfmt
low-<100 = 'less than 100'
100-500 = '100-500'
500-1000 = '500-1000'
1000<-high = 'over 1000'
;
run;

title "Controlling ranges with user-defined format";
proc gchart data=foo;
format value myfmt.;
vbar value / type=freq discrete;
run; Message was edited by: Robert Allison @ SAS
SAS Employee
Posts: 977

Re: Histograms

fixed it! Message was edited by: Robert Allison @ SAS
SAS Employee
Posts: 977

Re: Histograms

fixed it! Message was edited by: Robert Allison @ SAS
Super Contributor
Super Contributor
Posts: 3,174

Re: Histograms

Bookmark this page:

http://support.sas.com/forums/thread.jspa?messageID=27609

Scott Barry
SBBWorks, Inc.
SAS Employee
Posts: 977

Re: Histograms

Thanks for the tip, sbb!

I had to use the special character for the LT !
Contributor
Posts: 30

Re: Histograms

Thanks everybody!
Ask a Question
Discussion stats
  • 7 replies
  • 209 views
  • 0 likes
  • 3 in conversation