BookmarkSubscribeRSS Feed
tal83
Calcite | Level 5
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!
7 REPLIES 7
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
GraphGuy
Meteorite | Level 14
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
GraphGuy
Meteorite | Level 14
fixed it! Message was edited by: Robert Allison @ SAS
GraphGuy
Meteorite | Level 14
fixed it! Message was edited by: Robert Allison @ SAS
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Bookmark this page:

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

Scott Barry
SBBWorks, Inc.
GraphGuy
Meteorite | Level 14
Thanks for the tip, sbb!

I had to use the special character for the LT !
tal83
Calcite | Level 5
Thanks everybody!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2544 views
  • 0 likes
  • 3 in conversation