turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- proc gchart, overlay histograms

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-13-2011 12:06 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-14-2011 11:29 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-14-2011 02:44 PM

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