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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1542 views
  • 0 likes
  • 3 in conversation