BookmarkSubscribeRSS Feed
jdub
Calcite | Level 5

howdy

i have some code for two histograms and each displays in a separate graph, I'd like to overlay them and cannto figure out how to do it.  Here is my code for the two histograms:

title '1995:Q1 Age Distribution';

proc gchart data=manu_agedist(where=(time="1995:1" & agegrpfm^="14-99"));

vbar agegrpfm / discrete type=percent

sumvar=emp sum;

run;

title '2000:Q1 Manufacturing Employment Age Distribution';

proc gchart data=manu_agedist(where=(time="2000:1" & agegrpfm^="14-99"));

vbar agegrpfm / discrete type=percent

sumvar=emp sum;

run;

Do i need to create two data subsets, one for time=1995:1 and then again for time=2000:1, merge them into another dataset with two series and the plot each series?  Is there a way I can use proc gchart to graph each series and overlay them from one dataset?

How do I insert series labels in a chart with multiple series?

thx much

2 REPLIES 2
ballardw
Super User

By overlay do you mean that you actually want the values from one set of data to be "on top" of the other with the potential of the "top" values completely hiding the "bottom"?

Assuming that you have only the two values of the TIME variable it is likely that you are looking at using TIME as

as either a GROUP or SUBGROUP variable depending on your particular meaning for overlay.

SUBGROUP = Time in your code (if you exclude the TIME portion of the where clause) will stack the time periods vertically

GROUP= Time would place them side by side

Rick_SAS
SAS Super FREQ

You say you want to use GCHART, but if you decide to use the newer statistical graphics (SG) procedures, then see http://blogs.sas.com/iml/index.php?/archives/154-Overlaying-Two-Histograms-in-SAS.html

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 2076 views
  • 0 likes
  • 3 in conversation