Data visualization with SAS programming

width of BOX around NOTE in GCHART

Posts: 0

width of BOX around NOTE in GCHART

Is there a way to get SAS to size the

NOTE... BOX=... FONT=something_proportional...;

within a PROC GCHART to match the text within when it is proportional?

Using justify=CENTER just leaves too much space on both the left and right of the text. BSPACE doesn't seem to help. Must I resort to using DRAW?

Here's part of my code (which is actually embedded in a macro):

ods html file = "&graph_path\graphs.html";

filename gfile "&graph_path\&gname._client_participation_pie.cgm";

reset = all
gunit = PCT
device = CGMOFML
gsfname = gfile
xmax = 5 IN
ymax = 2.85 IN
ftext = "Helvetica"
htext = 4
cback = white
colors = ( black yellow blue green red )
pattern1 color = &color_pie_1 value = P4N135;
pattern2 color = &color_pie_2 value = P4X45;
pattern3 color = &color_pie_3 value = PSOLID;

title1 h = 1 ' '; /* no title, just a little space above */

proc gchart data = &p_gset;
format count COMMA9.;
pie reportcode /
sumvar = count
value = outside
angle = 30
percent = outside
move = ( 1, 30 ) PCT
box = 2
bspace = 1
height = 4
font = "HelveticaBold"
justify = CENTER
blank = YES
"N = &p_total"

ods html close;

Posts: 65

Re: width of BOX around NOTE in GCHART

I don't know how to control a box in sas graph, but what about "ods text" with a style? Here's a simple example which I stuck right after the "run;" of the preceding procedure. When I ran it, I got a blue box that was tight up against the text on all 4 sides. (Note, it assumes ods escapechar='^'.)

ods html text = "^{style [bordercolor=blue]This is text with a blue box around it}";

This uses SAS 9.2 syntax for the inline style. If you're using an earlier version, you'd need the old ^S={} syntax, but I think the "bordercolor" attribute has been around for a few versions now, so it should still work.

SAS Employee
Posts: 967

Re: width of BOX around NOTE in GCHART

Which version of SAS are you using? - There were some recent fixes/enhancements for the 'box' around text in certain situations.

Do you specifically want a CGM file? (I haven't done anything with cgm before, and I'd need to get a cgm-reader to view the output).

And, does that code work for you, using "ods html" and cgm together?
Posts: 0

Re: width of BOX around NOTE in GCHART

Karl, Interesting idea, and it will do the trick when I'm creating HTML output to use, but in this case I'm really only interested in the CGM. Using ODS HTML is just a means of getting the CGMs out. The text comes out in HTML but is not actually within the CGM.

Robert, I'm using version 9.1.3, and I had wondered if there were improvements in this area in 9.2. I heard this morning that we might upgrade in a few months, so maybe I should just sit tight. Or shut up and do it with Annotate. I'm looking forward to full user-written function capability and better LAYOUT.

The reason for CGMs (I use device=CGMOFML) is that they import into Word and PowerPoint well. All the graphic elements remain unchanged upon import, and as long as I use only the basic set of Postscript typefaces (Times, Helvetica, Courier), the type comes through unmolested as well. When someone wants to make a presentation using the graphs, they can stretch and shrink them all they want but the elements remain in the correct location and proportion relative to each other. As a side benefit, the CGMs are very compact by today's standards and the resulting Office files remain fairly small, too.

Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation