Data visualization with SAS programming

help creating area chart

Reply
Contributor
Posts: 66

help creating area chart

hi all,

i have a data set arranged with the following columns:

Month Day Hour EndUse LoadElec LoadGas

I think the columns Month/Day/Hour are pretty self-explanatory.  The column "EndUse" has 13 categories (Lighting,Cooking,Hotwater,AC,Heating,....).  I would like to create a chart showing how the various end-uses contribute to daily load for each month-day.  I haven't been able to find an option that allows me although the cloest I got was a series plot with the column "EndUse" as a parameter to the Group= option.

Esteemed Advisor
Posts: 7,288

help creating area chart

Have you looked at the code on Robert Allison's page:

http://robslink.com/SAS/democd7/aaaindex.htm

Contributor
Posts: 66

help creating area chart

thanks! i am curious as to why proc sgplot cannot handle something like this?

SAS Super FREQ
Posts: 3,404

help creating area chart

You might want to use PROC SORT to sort by EndUse and then use PROC MEANS to summarize the data for each Month+Day pair.

You can then use PROC SGPLOT to construct a line plot or PROC SGPANEL to construct a panel of line plots. See if the last two examples at http://blogs.sas.com/content/iml/2010/12/03/how-does-participation-in-social-media-vary-with-age/ are similar to what you want. If so, you can use the link in the first paragraph to download the program that created the plots.

SAS Super FREQ
Posts: 888

help creating area chart

If you want to draw this as an area plot using the SG procedures, you can use the BAND plot to do it. Set the LOWER = 0 and the UPPER=<your varialble>. You can also set transparency on the plot so that you can see obscured areas.

Hope this helps!
Dan

SAS Super FREQ
Posts: 1,079

help creating area chart

Contributor
Posts: 66

help creating area chart

awesome!!!

SAS Employee
Posts: 967

help creating area chart

Rather than area (or band) plots, I tend to prefer stacked bar charts for this kind of thing.  You can make the space between the bars zero, so that there's no gap between the bars, which gives it the same visual effect of the area plot, but since you have discrete bar segments, you can easily add mouse-over text (and do things like placing labels on each of the bar segments, etc).  Bar charts also let you do easy "grouping", which might come in handy with you (day/hour) data.

Here is an example:

http://robslink.com/SAS/democd48/smartphones.htm

http://robslink.com/SAS/democd48/smartphones_info.htm

Ask a Question
Discussion stats
  • 7 replies
  • 210 views
  • 6 likes
  • 6 in conversation