Data visualization with SAS programming

GraphDataFont not changing text on SGPLOT output

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

GraphDataFont not changing text on SGPLOT output

First off, I'm very new to SAS, and I've inherited a large program that creates all sorts of wonderful graphs. We upgraded to SAS 9.4 and now all the graphs are blurry (there are lots of other issues with this program, but let's take it one at a time).

 

The program uses ODS to output to HTML, with the setup looking like this:

 

ods graphics on / 
	reset		= all
	imagename 	= 'img1' 
	imagemap	= on ; 

ods listing close; * Close default output destination;

ods tagsets.msoffice2k_x 
	path	= "&path" 
	file	= "graph.html" 	/* Destination file for output*/
	gpath	= "&path\GRAPHS" 	/* Location for graphic output*/
	style	= statistical 				/* ODS Style template */
   	options ( panelcols="1" /* Number of columns in sheet */ 
			);

Note that although it is exported to HTML, the final dsestination is an Excel spread sheet (there is a later step that combines a bunch of documents into one excel book).

 

There is then lots of other code but I believe the step that actually outputs is the proc sgplot step, which appears to have nothing that changes formatting.

 

Basically, from what I can tell, it's using the "statistical" style without any changes.

 

The output is a vertical bar chart with the number for each bar being shown above the bar in small text (see attached image - zipped because PNG isn't an allowed format...). From searching on Google I have found that I can change the template, and I believe I need to be changing the GraphDataFont property. I have tested the other similar properties that affect the font and found that when I change them, I see a change in the graph. But when I change GraphDataFont, it does not change at all. Whether I set it to 1, 10, or 100, it looks exactly the same. Changing the other similar properties affects other areas but none that I could find affect this text.

 

Can anyone suggest what I could try to boost the size of this text? I set image_dpi on the ODS output to get the rest of the graphs larger but this text above each bar stays small and blurry. I have tried switching to using ODS EXCEL but this did not help.

 

 

Attachment

Accepted Solutions
Solution
‎01-31-2018 03:35 PM
SAS Super FREQ
Posts: 1,042

Re: GraphDataFont not changing text on SGPLOT output

The simplest solution is for you to use the DATALABELATTRS option on the VBAR statement (I assume that's the one you used). For example:

 

vbar cater / response=respvar data label datalabelattrs=(size=9pt);

 

Give that a try and let us know if that works for you.

 

Thanks!

Dan

View solution in original post


All Replies
Solution
‎01-31-2018 03:35 PM
SAS Super FREQ
Posts: 1,042

Re: GraphDataFont not changing text on SGPLOT output

The simplest solution is for you to use the DATALABELATTRS option on the VBAR statement (I assume that's the one you used). For example:

 

vbar cater / response=respvar data label datalabelattrs=(size=9pt);

 

Give that a try and let us know if that works for you.

 

Thanks!

Dan

Occasional Contributor
Posts: 8

Re: GraphDataFont not changing text on SGPLOT output

That worked like a treat, thank you so much!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 117 views
  • 0 likes
  • 2 in conversation