1
votes

I am working on a corporate-level summary report for my employer. Because this is a fairly high-level report, I'm trying to "pretty" it up a bit (I think the standard SAS output is exceptionally ugly). I've managed to include graphics using ODS REGION and the like, but I'm having trouble generating a fairly basic bar chart.

All I want to do is draw boxes onto the PDF file by specifiying X,Y and W,H and the background color. I've gotten close using this SUGI paper (which employs ODS REGION with a PROC GSLIDE).

That works OK, but I've run into many vexing little issues. For example:

  • There's a minimum height and width for GSLIDE (appx 3 points) which has made it very difficult to represent small numbers on my bar graph

  • The corners of GSLIDE are slightly rounded, causing strange looking "artifacts" when attempting to overlay and stack them

  • There's apparently a "maximum" width (appx 480 points). I think I might be able to solve this with the GOPTIONS VSIZE attribute, but I have to be careful because if the ODS REGION and GSLIDE are exactly the same size, then SAS (for some reason) thinks that the GSLIDE is bigger than the REGION and fails to render GSLIDE properly.

I've searched the internet for an easier approach, but it seems there are few SAS programmers trying to do what I'm doing. I know that I'm reinventing the wheel a bit in that SAS providers bar charts via SAS/GRAPH, but they don't provide the level of customization I need to display the results the way I want them.

How can I draw a simple rectangular shape, with nice square corners, and no weird width/height limitations, on a PDF file?


This isn't direclty relevant to the question, but since it's been brought up, here's an idea of what the bar chart looks like:

enter image description here

Each row measures a metric across a mutually exclusive sub-section of a larger population. The Gray bar represents the total size of the population being measured. The blue bar measures the metric (and the reported number is the metric across the sub-section). The "white bar" is the size of the total population. (The light blue bar is an alternate metric displayed only for those who are curious - it will always be smaller than the blue bar.) Some sub-sections contain no data, so they are displayed as "N/A".

There's also a rolling total. So, after one or a few sub-sections are reported, they are rolled into the rolling total. The gray background groups the related sub-sections, with the rolling total reported at the bottom.

This is pretty much exactly what I want this chart to look like. If it can be done using standard SAS charts, I'd be happy to use them - but I think it's been easier to get this effect on my own by painting the graph myself.

1
What version of SAS do you have? ODS Graphics (PROC SGPLOT, GTL, etc.) might be able to do what you need in terms of bar graphs. I would start there first - edit or start a new question with the bar graph question - and then see where we go from there. I might be able to help (I'm fairly good at bar charts), or if not then communities.sas.com has very support from the graphics developers.Joe
@Joe - I respect where you are coming from, but I've done it before - spending days trying to figure out how to trick SAS into producing a very specific format for my report, only to end up settling for about 90-95% of what I want. In this case, the bar charts themselves are so easy, I'd rather just seize control and render the output myself.JDB
I'd suggest at least posting the question on communities, even if you move forward separately. Dan, Sanjay, and Rob are really good at answering within an hour or two and almost always can tell you instantly if it's possible (and how) or not possible.Joe
@Joe - Included a snapshot, in case you are interested.JDB
JDB - what version of SAS do you have? If you have 9.3, or possibly 9.2, I think you could do this with a High-Low chart (which is pretty close to 'rolling your own bar chart', but is a bit more organized).Joe

1 Answers

0
votes

I found a partial answer... you can use a LayoutRegion defined via PROC TEMPLATE to set the background color of an ODS REGION. You still must "put something" within the region to force SAS to render it (for example, ODS TEXT = " ";), but it removes at least one pain point: minimum and maximum sizes.

Unfortunately, the corners are still rounded, but I'll update this answer if I can figure out a way to fix that via an attribute or something.