Click here to see the SAS code.
Click here to see the example.

---------------------------------------------------------------

SAS/Graph imitation of:
http://smpbff2.dsd.census.gov/TheDataWeb_HotReport/servlet/HotReportEngineServlet?reportid=fca1eb51df31daa5414e68eb578d9b2b&emailname=whazard@census.gov&filename=ed_general_v2.hrml

SAS/Graph doesn't have a built-in "paired tree bar" in gchart, so this takes a bit of work
(but the results are *very* nice, and worth it!)

Basically, I do 2 bar charts, and then put them side-by-side using 
"greplay".  And for the left bar chart, I multiple the values by -1
so they will point to the left (... and I use a user-defined format
called 'posval' to make the values show up as positive in the raxis).

For the left/blue/male bars, I suppress the midpoint value labels.
For the right/green/female bar chart, I let the midpoint value labels
show up, but I get a little tricky with them.  Gchart normally orders
the bars alphabetically/numerically based on the bar midpoint values,
but that won't sort the bars correctly with the labels I'm using.
Therefore I put the original data in the desired order, and then
I use those numeric (order) values as my bar midpoints, and I 
calculate a user-defined format on-the-fly to make these order
numbers show up as the desired text label (look for the cntlin 
syntax in the code).

For the titles, the male/female labels, and the 'thousands' label,
I use a gslide, which I also greplay onto the slide.

And, I add html mouse-over text to the bars, so you can easily 
see the actual values.

Rather than sticking a color legend at the bottom, I used the
"direct" approach, and annotated 'male' and 'female' labels
on the left and right sides of the graph.

And, although the blue background box (showing the age range
of "working people") looks simple, it's actually a little tricky.
Look very closely at the subtle xsys and ysys changes (in particular
the xsys) to see how I got the entire desired area shaded, by the
two annotated light blue bars.

Back to Samples Index