BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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";

goptions
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
noheading
percent = outside
;
note
move = ( 1, 30 ) PCT
box = 2
bspace = 1
height = 4
font = "HelveticaBold"
justify = CENTER
blank = YES
"N = &p_total"
;
run;

ods html close;


Thanks!
David
3 REPLIES 3
KarlK
Fluorite | Level 6
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.

Karl
GraphGuy
Meteorite | Level 14
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?
deleted_user
Not applicable
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.

Thanks,
David

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 761 views
  • 0 likes
  • 3 in conversation