Help using Base SAS procedures

proc gchart, overlay histograms

Reply
Contributor
Posts: 33

proc gchart, overlay histograms

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

Super User
Posts: 11,343

proc gchart, overlay histograms

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

SAS Super FREQ
Posts: 3,756

proc gchart, overlay histograms

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

Ask a Question
Discussion stats
  • 2 replies
  • 761 views
  • 0 likes
  • 3 in conversation